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

Toolbar Active control blur/focus-out events not happening when clicking within in Edge and Chrome #2494

Open
aagash-ni opened this issue Dec 11, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@aagash-ni
Copy link
Contributor

aagash-ni commented Dec 11, 2024

🐛 Bug Report

In Chrome and Edge, when a control (e.g., a button or text field) within a toolbar is focused or active, clicking anywhere else within the toolbar does not blur the currently active control or set its value. However, clicking outside the toolbar works as expected and blurs the active control.

This behavior functions correctly in Firefox, where clicking within the toolbar properly blurs the active control.

focusing-toolbar-issue

💻 Repro or Code Sample

  • Click on any element inside the toolbar to make it focused or active.
  • Then, click on any other area within the toolbar to blur or remove focus from the currently active control.

🤔 Expected Behavior

  • clicking on any area within the toolbar should blur or remove focus from the currently active control, just as it does when clicking outside the toolbar.

😯 Current Behavior

  • Clicking within the toolbar does not blur or focus out the currently active control

🔦 Context

Discussion link: https://dev.azure.com/ni/DevCentral/_git/Skyline/pullRequest/850146#1733521296

🌍 Your Environment

  • OS: Windows
  • Browser: Microsoft Edge, Google Chrome, Mozilla FireFox
@aagash-ni aagash-ni added bug Something isn't working triage New issue that needs to be reviewed labels Dec 11, 2024
@aagash-ni aagash-ni changed the title Toolbar blurring/focus-out (event handling) the active controls is not working when clicking the area within it Toolbar Active control blur/focus-out events not triggered when clicking within in Edge and Chrome Dec 11, 2024
@aagash-ni aagash-ni changed the title Toolbar Active control blur/focus-out events not triggered when clicking within in Edge and Chrome Toolbar Active control blur/focus-out events not happening when clicking within in Edge and Chrome Dec 11, 2024
@mollykreis
Copy link
Contributor

I'm not sure why the behavior is different between chromium and FF (I haven't looked for any issues filed to either browser), but the difference seems to be tied to delegatesFocus: true being set on the toolbar. With delegatesFocus: false, both browsers behave as described as the "Expected Behavior".

@rajsite
Copy link
Member

rajsite commented Jan 17, 2025

From mdn

If true, when a non-focusable part of the shadow DOM is clicked, or .focus() is called on the host element, the first focusable part inside the host's shadow DOM is given focus

So sounds like Chrome is behaving right for delegatesFocus: true based on the mdn description.

I think setting delegatesFocus: false / keeping it unset seems reasonable for the toolbar. The toolbar shadow root doesn't have anything focusable, it's all light dom stuff that was slotted that has focus. Curious if changing that setting messes with the roving tabindex behavior in unexpected ways.

@m-akinc m-akinc removed the triage New issue that needs to be reviewed label Jan 23, 2025
@m-akinc m-akinc moved this to Defined/Ready to Pickup in Nimble Design System Priorities Jan 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Defined/Ready to Pickup
Development

No branches or pull requests

4 participants