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.)
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.)
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" example
Testing that the Breadcrumb component is adequately accessible for our users (which a decent majority still actively use IE11 馃槩)
| Tech | Version |
| ----------- | ------- |
| Material-UI | v4.9.6 |
| React | |
| Browser | IE 11 |
| TypeScript | |
| etc. | |
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 a element, I believe it could land as above. Feel free to spend time on it.
@malouro @oliviertassinari Can I take this issue?
@ShehryarShoukat96 feel free to take this, haven't gotten the chance to get to it
Most helpful comment
@malouro @oliviertassinari Can I take this issue?