Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'openFocus' property does not work #62

Open
snrmwg opened this issue Mar 2, 2024 · 2 comments
Open

'openFocus' property does not work #62

snrmwg opened this issue Mar 2, 2024 · 2 comments

Comments

@snrmwg
Copy link

snrmwg commented Mar 2, 2024

Describe the bug

When opening a drawer containing form elements (i.e. textarea) I would like to focus a specific element. Tried to use the openFocus for that reason. But focus is not set. Compared to bits-ui Dialog where all works like expected. I put both usecases in the Stackblitz.

Reproduction

https://stackblitz.com/edit/vitejs-vite-q4c9mb?file=src%2FApp.svelte

Logs

No response

System Info

[email protected]
   System:
    OS: Linux 5.0 undefined
    CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 0 Bytes / 0 Bytes
    Shell: 1.0 - /bin/jsh
  Binaries:
    Node: 18.18.0 - /usr/local/bin/node
    Yarn: 1.22.19 - /usr/local/bin/yarn
    npm: 10.2.3 - /usr/local/bin/npm
    pnpm: 8.15.3 - /usr/local/bin/pnpm
  npmPackages:
    bits-ui: 0.18.6 => 0.18.6 
    svelte: ^4.2.12 => 4.2.12 
    typescript: ^5.2.2 => 5.3.3 
    vaul-svelte: 0.2.4 => 0.2.4

Severity

annoyance

@DarthGigi
Copy link

+1 having the same issue

@jramke
Copy link

jramke commented May 25, 2024

Got the same issue.
Some workarounds i found was to manually focus another element 300ms after you opened the drawer or (the one im using now) just place an focusable element inside the content and around your inputs.

<Drawer.Root bind:open={$editDialogOpen} onOpenChange={editDialogChange}>
  <Drawer.Content>
	  <!-- svelte-ignore a11y-no-noninteractive-tabindex -->
	  <div tabindex="0">
		  <Drawer.Header>
			  <Drawer.Title>Detail view</Drawer.Title>
		  </Drawer.Header>
		  ... more content where we got some inputs
	  </div>
  </Drawer.Content>
</Drawer.Root>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants