react-lottie icon indicating copy to clipboard operation
react-lottie copied to clipboard

TabIndex hardcoded to 0

Open 1ak31sha opened this issue 4 years ago • 3 comments

hi, i was facing an issue using lottie when my animation was presentational only but it was becoming tabbable due to the hardcoded tabindex = 0 https://github.com/chenqingspring/react-lottie/blob/56f72845de2ed652f763b92978a06201d3333dd8/src/index.js#L167 i saw this existing issue https://github.com/chenqingspring/react-lottie/issues/67 which proposed spreading the props and wondering if that could be added or create a new prop/configuration for setting the tabindex.

currently my workaround is something like

    const removeTabIndexFromLottie = (id: string) => {
      const lottieDiv = document.querySelector<HTMLElement>(
        `.Toggle-focusableContainer div[title=${id}]`
      );
      if (lottieDiv) {
        lottieDiv.tabIndex = -1;
      }
    };

but we prefer not to have to do stuff like this, i think the above issue&solution is much cleaner

btw, my first time using react-lottie and i love it! <3

1ak31sha avatar Apr 20 '21 17:04 1ak31sha

Hello. You can use this. https://www.npmjs.com/package/react-lottie-wrapper. Example: <Lottie tabIndex={-1} options={ defaultOptions } />

ghost avatar Aug 31 '21 11:08 ghost

This doesn't work. tabIndex is not a prop for Lottie components

Property 'tabIndex' does not exist on type 'IntrinsicAttributes & IntrinsicClassAttributes<Lottie> & Readonly<LottieProps> & Readonly<{ children?: ReactNode; }>'.

hugotox avatar Mar 24 '23 21:03 hugotox

Any solution?

101budspencer avatar Apr 24 '24 01:04 101budspencer