Title: [195512] trunk
Revision
195512
Author
[email protected]
Date
2016-01-23 18:47:42 -0800 (Sat, 23 Jan 2016)

Log Message

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 <[email protected]> on 2016-01-23
Reviewed by Timothy Hatcher.

* ManualTests/accessibility/collapsible-node-link-list.html: Added.

Source/WebInspectorUI:

Patch by Aaron Chu <[email protected]> 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.

Modified Paths

Added Paths

Diff

Modified: trunk/ChangeLog (195511 => 195512)


--- trunk/ChangeLog	2016-01-23 22:51:40 UTC (rev 195511)
+++ trunk/ChangeLog	2016-01-24 02:47:42 UTC (rev 195512)
@@ -1,3 +1,14 @@
+2016-01-23  Aaron Chu  <[email protected]>
+
+        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  <[email protected]>
 
         Fix internal Windows build

Added: trunk/ManualTests/accessibility/collapsible-node-link-list.html (0 => 195512)


--- trunk/ManualTests/accessibility/collapsible-node-link-list.html	                        (rev 0)
+++ trunk/ManualTests/accessibility/collapsible-node-link-list.html	2016-01-24 02:47:42 UTC (rev 195512)
@@ -0,0 +1,28 @@
+<html>
+<body>
+
+
+<p>Test for <a href="" 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>

Modified: trunk/Source/WebInspectorUI/ChangeLog (195511 => 195512)


--- trunk/Source/WebInspectorUI/ChangeLog	2016-01-23 22:51:40 UTC (rev 195511)
+++ trunk/Source/WebInspectorUI/ChangeLog	2016-01-24 02:47:42 UTC (rev 195512)
@@ -1,3 +1,22 @@
+2016-01-23  Aaron Chu  <[email protected]>
+
+        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  <[email protected]>
 
         Web Inspector: Reduce unnecessary forced layouts in TimelineRuler

Modified: trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js (195511 => 195512)


--- trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-01-23 22:51:40 UTC (rev 195511)
+++ trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js	2016-01-24 02:47:42 UTC (rev 195512)
@@ -1,5 +1,6 @@
 \xFE\xFFvar localizedStrings = new Object;
 
+localizedStrings["%d More\u2026"] = "%d More\u2026";
 localizedStrings[" (Prototype)"] = " (Prototype)";
 localizedStrings[" (line %s)"] = " (line %s)";
 localizedStrings["%.0f B"] = "%.0f B";

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js (195511 => 195512)


--- trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-01-23 22:51:40 UTC (rev 195511)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js	2016-01-24 02:47:42 UTC (rev 195512)
@@ -300,25 +300,43 @@
         }
 
         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) {

Modified: trunk/Source/WebInspectorUI/UserInterface/Views/Main.css (195511 => 195512)


--- trunk/Source/WebInspectorUI/UserInterface/Views/Main.css	2016-01-23 22:51:40 UTC (rev 195511)
+++ trunk/Source/WebInspectorUI/UserInterface/Views/Main.css	2016-01-24 02:47:42 UTC (rev 195512)
@@ -305,12 +305,23 @@
     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;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to