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

Fix toolbar stealing focus #6888

Merged
merged 7 commits into from
Mar 20, 2024
Merged

Fix toolbar stealing focus #6888

merged 7 commits into from
Mar 20, 2024

Conversation

fcollonval
Copy link
Contributor

@fcollonval fcollonval commented Jan 9, 2024

Pull Request

📖 Description

If a toolbar element (e.g. a button) action results in changing the focus to an element somewhere in the page, the active toolbar element should not be focused by the toolbar.

This can be achieved by calling preventDefault() on the event.

🎫 Issues

Fixes #6842

👩‍💻 Reviewer Notes

📑 Test Plan

I added a test with a toolbar button that set the focus to an external element. The test is against click and mouse down events.

✅ Checklist

General

  • I have included a change request file using $ yarn change
  • I have added tests for my changes.
  • I have tested my changes.
  • I have updated the project documentation to reflect my changes.
  • I have read the CONTRIBUTING documentation and followed the standards for this project.

Component-specific

⏭ Next Steps

@fcollonval
Copy link
Contributor Author

Thanks @scomea for #6899 - I'll wait for it to update this PR with the utility method you introduced.

@fcollonval
Copy link
Contributor Author

@scomea Would you mind having another look at this one?

Copy link
Collaborator

@scomea scomea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just the change comments, otherwise ok. Correct those and we'll merge.

@fcollonval
Copy link
Contributor Author

Thanks @scomea and @bheston for the review

@bheston bheston merged commit 5b2b801 into microsoft:master Mar 20, 2024
5 checks passed
@fcollonval fcollonval deleted the patch-1 branch March 20, 2024 10:25
janechu pushed a commit that referenced this pull request Jun 10, 2024
* Fix toolbar stealing focus

* Implement suggestion by @scomea

* Add test

* Use 'getRootActiveElement'

* Change files

* Apply review comment

---------

Co-authored-by: Frédéric Collonval <fcollonval@users.noreply.github.com>
Co-authored-by: Stephane Comeau <stephcomeau@msn.com>
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

Successfully merging this pull request may close these issues.

Issue with focus on a toolbar clicked button
3 participants