Blame view

天文台pc/tianwentai-ui/node_modules/@mui/utils/esm/isFocusVisible/isFocusVisible.js 672 Bytes
bc518174   王天杨   提交两个项目文件
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
  /**
   * Returns a boolean indicating if the event's target has :focus-visible
   */
  export default function isFocusVisible(element) {
    try {
      return element.matches(':focus-visible');
    } catch (error) {
      // Do not warn on jsdom tests, otherwise all tests that rely on focus have to be skipped
      // Tests that rely on `:focus-visible` will still have to be skipped in jsdom
      if (process.env.NODE_ENV !== 'production' && !window.navigator.userAgent.includes('jsdom')) {
        console.warn(['MUI: The `:focus-visible` pseudo class is not supported in this browser.', 'Some components rely on this feature to work properly.'].join('\n'));
      }
    }
    return false;
  }