Changeset 195512 in webkit


Ignore:
Timestamp:
Jan 23, 2016 6:47:42 PM (8 years ago)
Author:
commit-queue@webkit.org
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 <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.

Location:
trunk
Files:
1 added
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/ChangeLog

    r195498 r195512  
     12016-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
    1122016-01-22  Alex Christensen  <achristensen@webkit.org>
    213
  • trunk/Source/WebInspectorUI/ChangeLog

    r195504 r195512  
     12016-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
    1202016-01-22  Joseph Pecoraro  <pecoraro@apple.com>
    221
  • trunk/Source/WebInspectorUI/Localizations/en.lproj/localizedStrings.js

    r195432 r195512  
    11var localizedStrings = new Object;
    22
     3localizedStrings["%d More\u2026"] = "%d More\u2026";
    34localizedStrings[" (Prototype)"] = " (Prototype)";
    45localizedStrings[" (line %s)"] = " (line %s)";
  • trunk/Source/WebInspectorUI/UserInterface/Views/DOMNodeDetailsSidebarPanel.js

    r194116 r195512  
    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                 }
    320             }
    321             return hasLinks ? linkList : null;
     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++;
     326            }
     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
  • trunk/Source/WebInspectorUI/UserInterface/Views/Main.css

    r194506 r195512  
    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;
     
    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;
Note: See TracChangeset for help on using the changeset viewer.