Skip to content

Prevent focus on dialog #935

Answered by benoitgrelard
kerimcet asked this question in Help
Oct 26, 2021 · 2 comments · 3 replies
Discussion options

You must be logged in to vote

Hi @kerimcet, typically you wouldn't want to completely prevent focus inside the dialog otherwise you'll be breaking accessibility. However, if what you want is prevent the default autofocus and focus something else inside the Dialog instead, there most defeinitley is a way to do this. You can simple do event.preventDefault() in Content's onOpenAutoFocus prop and then run your own focus logic in there.

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
3 replies
@kerimcet
Comment options

@Sumonche016
Comment options

@anthony-urbina
Comment options

Answer selected by kerimcet
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
5 participants