question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Modal: Set default primary focus to something besides primary button

See original GitHub issue

What package(s) are you using?

  • carbon-components
  • carbon-components-react

Detailed description

Describe in detail the issue you’re having.

Currently the default focused button on a modal is the primary button if it exists. In situations where users are interacting quickly with the UI, they might inadvertently trigger the primary button event which could include things like deleting.

Is this issue related to a specific component?

Modal that has passiveModal = false

What did you expect to happen? What happened instead? What would you like to see changed?

Set default primary focus to be either the secondary button or close button.

What browser are you working in?

Brave Version 1.12.114 Chromium: 84.0.4147.135 (Official Build) (64-bit)

What version of the Carbon Design System are you using?

carbon-components-react 7.21.0-rc.0

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

Cloud IKS UI, no

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (7 by maintainers)

github_iconTop GitHub Comments

github_iconTop Results From Across the Web

focus default button on bootstrap modal - Stack Overflow
I have tried adding script in the ngAfterViewInit to handle the shown.bs.modal event and set focus on the primary button but this does...
Read more >
Modal Dialog Example | APG | WAI - W3C
Initial focus is set on the OK button, which is the last focusable element. This is for efficiency since most users will simply...
Read more >
Transactional modal - Carbon Design System
Modals focus the user's attention exclusively on one task or piece of information via a window that sits ... Contains a cancel and...
Read more >
Dialog Focus in Screen Readers - Adrian Roselli
Managing focus for a modal is conceptually straightforward. Whatever launched the modal receives focus again when the modal closes. Easy-peasy.
Read more >
Modal - Shopify Polaris
When a modal opens, focus moves automatically to the modal container so it can be accessed by keyboard users · While the modal...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found