Web Inspector: AXI: node-link-list should be collapsible
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Jan 2016 02:47:42 +0000 (02:47 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sun, 24 Jan 2016 02:47:42 +0000 (02:47 +0000)
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.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@195512 268f45cc-cd09-0410-ab3c-d52691b4dbfc

ChangeLog
ManualTests/accessibility/collapsible-node-link-list.html [new file with mode: 0644]
Source/WebInspectorUI/ChangeLog
Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js
Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js
Source/WebInspectorUI/UserInterface/Views/Main.css

index ae4c95c..6b21fe5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2016-01-23  Aaron Chu  <arona.chu@gmail.com>
+
+        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
+
+        Reviewed by Timothy Hatcher.
+
+        * ManualTests/accessibility/collapsible-node-link-list.html: Added.
+
 2016-01-22  Alex Christensen  <achristensen@webkit.org>
 
         Fix internal Windows build
diff --git a/ManualTests/accessibility/collapsible-node-link-list.html b/ManualTests/accessibility/collapsible-node-link-list.html
new file mode 100644 (file)
index 0000000..49d831e
--- /dev/null
@@ -0,0 +1,28 @@
+<html>
+<body>
+
+
+<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>
+<ol>
+<li>Open Accessibility Inspector.</li>
+<li>In DOM tree in the Web Inspector, click on the unordered list below.</li>
+<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>
+<li>In the Accessibility Inspector click on "5 more&hellip;" to reveal the remaining 5 nodes.</li>
+<li>If the click on the said link does not function as described in #4, the test fails.</li>
+</ol>
+
+<ul>
+<li>Item 1</li>
+<li>Item 2</li>
+<li>Item 3</li>
+<li>Item 4</li>
+<li>Item 5</li>
+<li>Item 6</li>
+<li>Item 7</li>
+<li>Item 8</li>
+<li>Item 9</li>
+<li>Item 10</li>
+</ul>
+
+</body>
+</html>
index 699bf3b..7444a27 100644 (file)
@@ -1,3 +1,22 @@
+2016-01-23  Aaron Chu  <arona.chu@gmail.com>
+
+        Web Inspector: AXI: node-link-list should be collapsible
+        https://bugs.webkit.org/show_bug.cgi?id=130911
+        
+        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.
+
 2016-01-22  Joseph Pecoraro  <pecoraro@apple.com>
 
         Web Inspector: Reduce unnecessary forced layouts in TimelineRuler
index 29ade53..3904e96 100644 (file)
Binary files a/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js and b/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js differ
index cb77369..1ff9da5 100644 (file)
@@ -300,25 +300,43 @@ WebInspector.DOMNodeDetailsSidebarPanel = class DOMNodeDetailsSidebarPanel exten
         }
 
         function linkListForNodeIds(nodeIds) {
-            var hasLinks = false;
-            var linkList = null;
-            if (nodeIds !== undefined) {
-                linkList = document.createElement("ul");
-                linkList.className = "node-link-list";    
-                for (var nodeId of nodeIds) {
-                    var node = WebInspector.domTreeManager.nodeForId(nodeId);
-                    if (node) {
-                        var link = WebInspector.linkifyAccessibilityNodeReference(node);
-                        if (link) {
-                            hasLinks = true;
-                            var listitem = document.createElement("li");
-                            listitem.appendChild(link);
-                            linkList.appendChild(listitem);
-                        }
-                    }
-                }
+            if (!nodeIds) 
+                return null;
+
+            const itemsToShow = 5;
+            let hasLinks = false;
+            let listItemCount = 0;
+            let container = document.createElement("div");
+            container.classList.add("list-container")
+            let linkList = container.createChild("ul", "node-link-list");            
+            let initiallyHiddenItems = [];
+            for (let nodeId of nodeIds) {
+                let node = WebInspector.domTreeManager.nodeForId(nodeId);
+                if (!node)
+                    continue;
+                let link = WebInspector.linkifyAccessibilityNodeReference(node);
+                hasLinks = true;
+                let li = linkList.createChild("li");
+                li.appendChild(link);
+                if (listItemCount >= itemsToShow) {  
+                    li.hidden = true;
+                    initiallyHiddenItems.push(li);
+                } 
+                listItemCount++;
             }
-            return hasLinks ? linkList : null;
+            container.appendChild(linkList);
+            if (listItemCount > itemsToShow) {
+                let moreNodesButton = container.createChild("button", "expand-list-button");
+                moreNodesButton.textContent = WebInspector.UIString("%d More\u2026").format(listItemCount - itemsToShow);
+                moreNodesButton.addEventListener("click", () => {
+                    initiallyHiddenItems.forEach((element) => element.hidden = false);
+                    moreNodesButton.remove();
+                });
+            }
+            if (hasLinks) 
+                return container;
+
+            return null;
         }
 
         function accessibilityPropertiesCallback(accessibilityProperties) {
index abd9bec..fc0bb2f 100644 (file)
@@ -305,12 +305,23 @@ body.window-inactive #split-content-browser {
     display: none !important;
 }
 
+.expand-list-button {
+    -webkit-appearance: none;
+    text-decoration: underline;
+    background-color: transparent;
+    padding: 0;
+    margin: 0;
+    border: 0;
+    cursor: pointer;
+    color: black;
+}
+
 .node-link {
     text-decoration: underline;
     cursor: pointer;
 }
 
-.node-link-list, .node-link-list li {
+.node-link-list, .node-link-list li:not([hidden]) {
     display: block;
     margin: 0;
     padding: 0;