-
-
Notifications
You must be signed in to change notification settings - Fork 32.4k
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
[Breadcrumbs] Focus goes to top of page after expanding in IE11 #20280
Comments
The problem doesn't seem limited to IE 11. What do you think of this diff? remote: Resolving deltas: 100% (143/143), completed with 29 local objects.
diff --git a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.js b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.js
index d958e5362..c54eeddd2 100644
--- a/packages/material-ui/src/Breadcrumbs/Breadcrumbs.js
+++ b/packages/material-ui/src/Breadcrumbs/Breadcrumbs.js
@@ -63,8 +63,9 @@ const Breadcrumbs = React.forwardRef(function Breadcrumbs(props, ref) {
const [expanded, setExpanded] = React.useState(false);
const renderItemsBeforeAndAfter = (allItems) => {
- const handleClickExpand = () => {
+ const handleClickExpand = (event) => {
setExpanded(true);
+ event.currentTarget.parentNode.querySelector('a').focus();
};
// This defends against someone passing weird input, to ensure that if all |
Yeah something like that should work. 😄 I wouldn't mind strapping together a PR for this once I get the time to look at this a bit more Thanks! |
@malouro Outside the need for a safeguard against potentially none |
@malouro @oliviertassinari Can I take this issue? |
@shehryarshoukat96 feel free to take this, haven't gotten the chance to get to it |
Current Behavior 😯
In Internet Explorer 11, the focus is shifting to the top of the page after expanding the Breadcrumb list via keyboard.
(Note: if it helps to debug - after hitting the expand button,
document.activeElement
returns the<body>
element of the page. This is also the case in Chrome and Firefox, but IE11 seems to handle the situation much differently.)Expected Behavior 🤔
Focus should remain contained within the Breadcrumb list, possibly going to the next newly-revealed Breadcrumb.
Optionally, if there was some sort of available
onExpand
handler, this could probably be achieved via user implementation. (Unsure if this would constitute a separate issue all together, or even be a possible breaking change, but figured I'd put out the suggestion anyway.)Steps to Reproduce 🕹
Using the current live documentation example of
Collapsed Breadcrumbs
, since I think codesandbox examples don't render in IE11?Steps:
...
button in the "Collapsed breadcrumbs" exampleContext 🔦
Testing that the Breadcrumb component is adequately accessible for our users (which a decent majority still actively use IE11 😢)
Your Environment 🌎
The text was updated successfully, but these errors were encountered: