chrome-devtools-frontend 1.0.1027150 → 1.0.1027447
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
| 
         @@ -133,7 +133,7 @@ const DEFAULT_CONFIG = { 
     | 
|
| 
       133 
133 
     | 
    
         
             
                // ignored by the 'aria-valid-attr' rule.
         
     | 
| 
       134 
134 
     | 
    
         
             
                // This should be removed after axe-core is updated.
         
     | 
| 
       135 
135 
     | 
    
         
             
                // See: https://github.com/dequelabs/axe-core/issues/1457
         
     | 
| 
       136 
     | 
    
         
            -
                {id: 'aria-valid-attr', options: ['aria-placeholder']}
         
     | 
| 
      
 136 
     | 
    
         
            +
                {id: 'aria-valid-attr', options: ['aria-placeholder', 'aria-description']}
         
     | 
| 
       137 
137 
     | 
    
         
             
              ],
         
     | 
| 
       138 
138 
     | 
    
         
             
              runOnly: {type: 'tags', values: {include: ['wcag2a', 'best-practice'], exclude: ['experimental']}}
         
     | 
| 
       139 
139 
     | 
    
         
             
            };
         
     | 
| 
         @@ -229,6 +229,7 @@ const ATTRIBUTES = new Set<string>([ 
     | 
|
| 
       229 
229 
     | 
    
         
             
              'aria-activedescendant',
         
     | 
| 
       230 
230 
     | 
    
         
             
              'aria-atomic',
         
     | 
| 
       231 
231 
     | 
    
         
             
              'aria-autocomplete',
         
     | 
| 
      
 232 
     | 
    
         
            +
              'aria-braillelabel',
         
     | 
| 
       232 
233 
     | 
    
         
             
              'aria-brailleroledescription',
         
     | 
| 
       233 
234 
     | 
    
         
             
              'aria-busy',
         
     | 
| 
       234 
235 
     | 
    
         
             
              'aria-checked',
         
     | 
| 
         @@ -239,6 +240,7 @@ const ATTRIBUTES = new Set<string>([ 
     | 
|
| 
       239 
240 
     | 
    
         
             
              'aria-controls',
         
     | 
| 
       240 
241 
     | 
    
         
             
              'aria-current',
         
     | 
| 
       241 
242 
     | 
    
         
             
              'aria-describedby',
         
     | 
| 
      
 243 
     | 
    
         
            +
              'aria-description',
         
     | 
| 
       242 
244 
     | 
    
         
             
              'aria-details',
         
     | 
| 
       243 
245 
     | 
    
         
             
              'aria-disabled',
         
     | 
| 
       244 
246 
     | 
    
         
             
              'aria-dropeffect',
         
     | 
| 
         @@ -344,10 +344,6 @@ export function setAccessibleName(element: Element, name: string): void { 
     | 
|
| 
       344 
344 
     | 
    
         
             
              element.setAttribute('aria-label', name);
         
     | 
| 
       345 
345 
     | 
    
         
             
            }
         
     | 
| 
       346 
346 
     | 
    
         | 
| 
       347 
     | 
    
         
            -
            // TODO(crbug.com/1172300) Ignored during the jsdoc to ts migration
         
     | 
| 
       348 
     | 
    
         
            -
            // eslint-disable-next-line @typescript-eslint/naming-convention
         
     | 
| 
       349 
     | 
    
         
            -
            const _descriptionMap = new WeakMap<Element, Element>();
         
     | 
| 
       350 
     | 
    
         
            -
             
     | 
| 
       351 
347 
     | 
    
         
             
            export function setDescription(element: Element, description: string): void {
         
     | 
| 
       352 
348 
     | 
    
         
             
              // Nodes in the accessibility tree are made up of a core
         
     | 
| 
       353 
349 
     | 
    
         
             
              // triplet of "name", "value", "description"
         
     | 
| 
         @@ -360,77 +356,7 @@ export function setDescription(element: Element, description: string): void { 
     | 
|
| 
       360 
356 
     | 
    
         
             
              // to appear with the description when the element is hovered.
         
     | 
| 
       361 
357 
     | 
    
         
             
              // This is usually fine, except that DevTools has its own styled
         
     | 
| 
       362 
358 
     | 
    
         
             
              // tooltips which would interfere with the browser tooltips.
         
     | 
| 
       363 
     | 
    
         
            -
               
     | 
| 
       364 
     | 
    
         
            -
              // In future, the aria-description attribute may be used once it
         
     | 
| 
       365 
     | 
    
         
            -
              // is unflagged.
         
     | 
| 
       366 
     | 
    
         
            -
              //
         
     | 
| 
       367 
     | 
    
         
            -
              // aria-describedby requires that an extra element exist in DOM
         
     | 
| 
       368 
     | 
    
         
            -
              // that this element can point to. Both elements also have to
         
     | 
| 
       369 
     | 
    
         
            -
              // be in the same shadow root. This is not trivial to manage.
         
     | 
| 
       370 
     | 
    
         
            -
              // The rest of DevTools shouldn't have to worry about this,
         
     | 
| 
       371 
     | 
    
         
            -
              // so there is some unfortunate code below.
         
     | 
| 
       372 
     | 
    
         
            -
             
     | 
| 
       373 
     | 
    
         
            -
              const oldDescription = _descriptionMap.get(element);
         
     | 
| 
       374 
     | 
    
         
            -
              if (oldDescription) {
         
     | 
| 
       375 
     | 
    
         
            -
                oldDescription.remove();
         
     | 
| 
       376 
     | 
    
         
            -
              }
         
     | 
| 
       377 
     | 
    
         
            -
              element.removeAttribute('data-aria-utils-animation-hack');
         
     | 
| 
       378 
     | 
    
         
            -
             
     | 
| 
       379 
     | 
    
         
            -
              if (!description) {
         
     | 
| 
       380 
     | 
    
         
            -
                _descriptionMap.delete(element);
         
     | 
| 
       381 
     | 
    
         
            -
                element.removeAttribute('aria-describedby');
         
     | 
| 
       382 
     | 
    
         
            -
                return;
         
     | 
| 
       383 
     | 
    
         
            -
              }
         
     | 
| 
       384 
     | 
    
         
            -
             
     | 
| 
       385 
     | 
    
         
            -
              // We make a hidden element that contains the decsription
         
     | 
| 
       386 
     | 
    
         
            -
              // and will be pointed to by aria-describedby.
         
     | 
| 
       387 
     | 
    
         
            -
              const descriptionElement = document.createElement('span');
         
     | 
| 
       388 
     | 
    
         
            -
              descriptionElement.textContent = description;
         
     | 
| 
       389 
     | 
    
         
            -
              descriptionElement.style.display = 'none';
         
     | 
| 
       390 
     | 
    
         
            -
              ensureId(descriptionElement);
         
     | 
| 
       391 
     | 
    
         
            -
              element.setAttribute('aria-describedby', descriptionElement.id);
         
     | 
| 
       392 
     | 
    
         
            -
              _descriptionMap.set(element, descriptionElement);
         
     | 
| 
       393 
     | 
    
         
            -
             
     | 
| 
       394 
     | 
    
         
            -
              // Now we have to actually put this description element
         
     | 
| 
       395 
     | 
    
         
            -
              // somewhere in the DOM so that we can point to it.
         
     | 
| 
       396 
     | 
    
         
            -
              // It would be nice to just put it in the body, but that
         
     | 
| 
       397 
     | 
    
         
            -
              // wouldn't work if the main element is in a shadow root.
         
     | 
| 
       398 
     | 
    
         
            -
              // So the cleanest approach is to add the description element
         
     | 
| 
       399 
     | 
    
         
            -
              // as a child of the main element. But wait! Some HTML elements
         
     | 
| 
       400 
     | 
    
         
            -
              // aren't supposed to have children. Blink won't search inside
         
     | 
| 
       401 
     | 
    
         
            -
              // these elements, and won't find our description element.
         
     | 
| 
       402 
     | 
    
         
            -
              const contentfulVoidTags = new Set<string>(['INPUT', 'IMG']);
         
     | 
| 
       403 
     | 
    
         
            -
              if (!contentfulVoidTags.has(element.tagName)) {
         
     | 
| 
       404 
     | 
    
         
            -
                element.appendChild(descriptionElement);
         
     | 
| 
       405 
     | 
    
         
            -
                // If we made it here, someone setting .textContent
         
     | 
| 
       406 
     | 
    
         
            -
                // or removeChildren on the element will blow away
         
     | 
| 
       407 
     | 
    
         
            -
                // our description. At least we tried our best!
         
     | 
| 
       408 
     | 
    
         
            -
                return;
         
     | 
| 
       409 
     | 
    
         
            -
              }
         
     | 
| 
       410 
     | 
    
         
            -
             
     | 
| 
       411 
     | 
    
         
            -
              // We have some special element, like an <input>, where putting the
         
     | 
| 
       412 
     | 
    
         
            -
              // description element inside it doesn't work.
         
     | 
| 
       413 
     | 
    
         
            -
              // Lets try the next best thing, and just put the description element
         
     | 
| 
       414 
     | 
    
         
            -
              // next to it in the DOM.
         
     | 
| 
       415 
     | 
    
         
            -
              const inserted = element.insertAdjacentElement('afterend', descriptionElement);
         
     | 
| 
       416 
     | 
    
         
            -
              if (inserted) {
         
     | 
| 
       417 
     | 
    
         
            -
                return;
         
     | 
| 
       418 
     | 
    
         
            -
              }
         
     | 
| 
       419 
     | 
    
         
            -
             
     | 
| 
       420 
     | 
    
         
            -
              // Uh oh, the insertion didn't work! That means we aren't currently in the DOM.
         
     | 
| 
       421 
     | 
    
         
            -
              // How can we find out when the element enters the DOM?
         
     | 
| 
       422 
     | 
    
         
            -
              // See inspectorCommon.css
         
     | 
| 
       423 
     | 
    
         
            -
              element.setAttribute('data-aria-utils-animation-hack', 'sorry');
         
     | 
| 
       424 
     | 
    
         
            -
              element.addEventListener('animationend', () => {
         
     | 
| 
       425 
     | 
    
         
            -
                // Someone might have made a new description in the meantime.
         
     | 
| 
       426 
     | 
    
         
            -
                if (_descriptionMap.get(element) !== descriptionElement) {
         
     | 
| 
       427 
     | 
    
         
            -
                  return;
         
     | 
| 
       428 
     | 
    
         
            -
                }
         
     | 
| 
       429 
     | 
    
         
            -
                element.removeAttribute('data-aria-utils-animation-hack');
         
     | 
| 
       430 
     | 
    
         
            -
             
     | 
| 
       431 
     | 
    
         
            -
                // Try it again. This time we are in the DOM, so it *should* work.
         
     | 
| 
       432 
     | 
    
         
            -
                element.insertAdjacentElement('afterend', descriptionElement);
         
     | 
| 
       433 
     | 
    
         
            -
              }, {once: true});
         
     | 
| 
      
 359 
     | 
    
         
            +
              element.setAttribute('aria-description', description);
         
     | 
| 
       434 
360 
     | 
    
         
             
            }
         
     | 
| 
       435 
361 
     | 
    
         | 
| 
       436 
362 
     | 
    
         
             
            export function setActiveDescendant(element: Element, activedescendant: Element|null): void {
         
     | 
| 
         @@ -629,15 +629,6 @@ button.link:focus-visible { 
     | 
|
| 
       629 
629 
     | 
    
         
             
              --override-link-focus-background-color: rgb(230 230 230 / 8%);
         
     | 
| 
       630 
630 
     | 
    
         
             
            }
         
     | 
| 
       631 
631 
     | 
    
         | 
| 
       632 
     | 
    
         
            -
            /* See ARIAUtils.js */
         
     | 
| 
       633 
     | 
    
         
            -
            [data-aria-utils-animation-hack] {
         
     | 
| 
       634 
     | 
    
         
            -
              animation: ANIMATION-HACK 0s;
         
     | 
| 
       635 
     | 
    
         
            -
            }
         
     | 
| 
       636 
     | 
    
         
            -
             
     | 
| 
       637 
     | 
    
         
            -
            @keyframes ANIMATION-HACK {
         
     | 
| 
       638 
     | 
    
         
            -
              /* empty keyframe to trigger the animation hack above */
         
     | 
| 
       639 
     | 
    
         
            -
            }
         
     | 
| 
       640 
     | 
    
         
            -
             
     | 
| 
       641 
632 
     | 
    
         
             
            @media (forced-colors: active) {
         
     | 
| 
       642 
633 
     | 
    
         
             
              .dimmed,
         
     | 
| 
       643 
634 
     | 
    
         
             
              .chrome-select:disabled {
         
     | 
    
        package/package.json
    CHANGED