Skip to content

Commit bcc013d

Browse files
shadow-chunliwebkit-commit-queue
authored andcommitted
Web Inspector: AXI: node-link-list should be collapsible
https://bugs.webkit.org/show_bug.cgi?id=130911 .: Added a manual test to test the node list in the Accessibility Inspector Patch by Aaron Chu <arona.chu@gmail.com> on 2016-01-23 Reviewed by Timothy Hatcher. * ManualTests/accessibility/collapsible-node-link-list.html: Added. Source/WebInspectorUI: Patch by Aaron Chu <arona.chu@gmail.com> on 2016-01-23 Reviewed by Timothy Hatcher. Accessibility Inspector: for a very long children node list, only the first 5 nodes are shown. Remaining nodes are hidden by a "# More…" link by which a user can click to reveal the remainder of the node list. * Localizations/en.lproj/localizedStrings.js: * UserInterface/Views/DOMNodeDetailsSidebarPanel.js: (WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.linkListForNodeIds): * UserInterface/Views/Main.css: (.expand-list-button): (.node-link-list, .node-link-list li:not([hidden])): (.node-link-list, .node-link-list li): Deleted. Canonical link: https://commits.webkit.org/171471@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195512 268f45cc-cd09-0410-ab3c-d52691b4dbfc
1 parent 38a1eca commit bcc013d

6 files changed

Lines changed: 106 additions & 19 deletions

File tree

ChangeLog

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,14 @@
1+
2016-01-23 Aaron Chu <arona.chu@gmail.com>
2+
3+
Web Inspector: AXI: node-link-list should be collapsible
4+
https://bugs.webkit.org/show_bug.cgi?id=130911
5+
6+
Added a manual test to test the node list in the Accessibility Inspector
7+
8+
Reviewed by Timothy Hatcher.
9+
10+
* ManualTests/accessibility/collapsible-node-link-list.html: Added.
11+
112
2016-01-22 Alex Christensen <achristensen@webkit.org>
213

314
Fix internal Windows build
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<html>
2+
<body>
3+
4+
5+
<p>Test for <a href="https://bugs.webkit.org/show_bug.cgi?id=130911">Bug 130911: Web Inspector: AXI: node-link-list should be collapsible</a>.</p>
6+
<ol>
7+
<li>Open Accessibility Inspector.</li>
8+
<li>In DOM tree in the Web Inspector, click on the unordered list below.</li>
9+
<li>In the Accessibility Inspector, you should be able to see that 5 out of 10 nodes are showing. The remaining 5 are hidden. If you do not see this, the test fails.</li>
10+
<li>In the Accessibility Inspector click on "5 more&hellip;" to reveal the remaining 5 nodes.</li>
11+
<li>If the click on the said link does not function as described in #4, the test fails.</li>
12+
</ol>
13+
14+
<ul>
15+
<li>Item 1</li>
16+
<li>Item 2</li>
17+
<li>Item 3</li>
18+
<li>Item 4</li>
19+
<li>Item 5</li>
20+
<li>Item 6</li>
21+
<li>Item 7</li>
22+
<li>Item 8</li>
23+
<li>Item 9</li>
24+
<li>Item 10</li>
25+
</ul>
26+
27+
</body>
28+
</html>

Source/WebInspectorUI/ChangeLog

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,22 @@
1+
2016-01-23 Aaron Chu <arona.chu@gmail.com>
2+
3+
Web Inspector: AXI: node-link-list should be collapsible
4+
https://bugs.webkit.org/show_bug.cgi?id=130911
5+
6+
Reviewed by Timothy Hatcher.
7+
8+
Accessibility Inspector: for a very long children node list, only the first 5 nodes are shown.
9+
Remaining nodes are hidden by a "# More…" link by which a user can click to reveal the remainder
10+
of the node list.
11+
12+
* Localizations/en.lproj/localizedStrings.js:
13+
* UserInterface/Views/DOMNodeDetailsSidebarPanel.js:
14+
(WebInspector.DOMNodeDetailsSidebarPanel.prototype._refreshAccessibility.linkListForNodeIds):
15+
* UserInterface/Views/Main.css:
16+
(.expand-list-button):
17+
(.node-link-list, .node-link-list li:not([hidden])):
18+
(.node-link-list, .node-link-list li): Deleted.
19+
120
2016-01-22 Joseph Pecoraro <pecoraro@apple.com>
221

322
Web Inspector: Reduce unnecessary forced layouts in TimelineRuler
106 Bytes
Binary file not shown.

Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js

Lines changed: 36 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -300,25 +300,43 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
300300
}
301301

302302
function linkListForNodeIds(nodeIds) {
303-
var hasLinks = false;
304-
var linkList = null;
305-
if (nodeIds !== undefined) {
306-
linkList = document.createElement("ul");
307-
linkList.className = "node-link-list";
308-
for (var nodeId of nodeIds) {
309-
var node = WebInspector.domTreeManager.nodeForId(nodeId);
310-
if (node) {
311-
var link = WebInspector.linkifyAccessibilityNodeReference(node);
312-
if (link) {
313-
hasLinks = true;
314-
var listitem = document.createElement("li");
315-
listitem.appendChild(link);
316-
linkList.appendChild(listitem);
317-
}
318-
}
319-
}
303+
if (!nodeIds)
304+
return null;
305+
306+
const itemsToShow = 5;
307+
let hasLinks = false;
308+
let listItemCount = 0;
309+
let container = document.createElement("div");
310+
container.classList.add("list-container")
311+
let linkList = container.createChild("ul", "node-link-list");
312+
let initiallyHiddenItems = [];
313+
for (let nodeId of nodeIds) {
314+
let node = WebInspector.domTreeManager.nodeForId(nodeId);
315+
if (!node)
316+
continue;
317+
let link = WebInspector.linkifyAccessibilityNodeReference(node);
318+
hasLinks = true;
319+
let li = linkList.createChild("li");
320+
li.appendChild(link);
321+
if (listItemCount >= itemsToShow) {
322+
li.hidden = true;
323+
initiallyHiddenItems.push(li);
324+
}
325+
listItemCount++;
320326
}
321-
return hasLinks ? linkList : null;
327+
container.appendChild(linkList);
328+
if (listItemCount > itemsToShow) {
329+
let moreNodesButton = container.createChild("button", "expand-list-button");
330+
moreNodesButton.textContent = WebInspector.UIString("%d More\u2026").format(listItemCount - itemsToShow);
331+
moreNodesButton.addEventListener("click", () => {
332+
initiallyHiddenItems.forEach((element) => element.hidden = false);
333+
moreNodesButton.remove();
334+
});
335+
}
336+
if (hasLinks)
337+
return container;
338+
339+
return null;
322340
}
323341

324342
function accessibilityPropertiesCallback(accessibilityProperties) {

Source/WebInspectorUI/UserInterface/Views/Main.css

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -305,12 +305,23 @@ body.window-inactive #split-content-browser {
305305
display: none !important;
306306
}
307307

308+
.expand-list-button {
309+
-webkit-appearance: none;
310+
text-decoration: underline;
311+
background-color: transparent;
312+
padding: 0;
313+
margin: 0;
314+
border: 0;
315+
cursor: pointer;
316+
color: black;
317+
}
318+
308319
.node-link {
309320
text-decoration: underline;
310321
cursor: pointer;
311322
}
312323

313-
.node-link-list, .node-link-list li {
324+
.node-link-list, .node-link-list li:not([hidden]) {
314325
display: block;
315326
margin: 0;
316327
padding: 0;

0 commit comments

Comments
 (0)