Skip to content
Snippets Groups Projects
Commit 0aebb744 authored by Marius Dumitru Florea's avatar Marius Dumitru Florea
Browse files

XWIKI-22169: Breadcrumb dropdowns for navigation should be keyboard accessible

* Update breadcrumb PO
parent d116db49
No related branches found
No related tags found
No related merge requests found
......@@ -43,10 +43,21 @@ public BreadcrumbElement(WebElement container)
public List<String> getPath()
{
List<WebElement> pathElements = getDriver().findElementsWithoutWaiting(this.container, By.tagName("li"));
// Look for direct children because each path element may toggle a breadcrumb tree which has nested list items.
List<WebElement> pathElements =
getDriver().findElementsWithoutWaiting(this.container, By.cssSelector(":scope > li"));
List<String> path = new ArrayList<>();
for (WebElement pathElement : pathElements) {
path.add(pathElement.getText());
List<WebElement> links = getDriver().findElementsWithoutWaiting(pathElement, By.cssSelector(":scope > a"));
// If the path element has a link then we include only its label (because the path element may contains also
// text that is "visible" only to screen readers, e.g. from the button that toggles the breadcrumb tree).
// Even if "sr-only" text is not displayed it is still included in the output of getText() because it's not
// really hidden (check its CSS).
if (links.isEmpty()) {
path.add(pathElement.getText());
} else {
path.add(links.get(0).getText());
}
}
return path;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment