Giter VIP home page Giter VIP logo

Comments (6)

ling1726 avatar ling1726 commented on June 3, 2024

This should already be possible https://github.com/microsoft/keyborg/blob/bdfc82f67b743c64e8d9ec0bfac50b75d72e9cef/src/FocusEvent.ts#L252-L259

image

from tabster.

khmakoto avatar khmakoto commented on June 3, 2024

@ling1726 I know that you can check if something was programmatically focused or not, but I don't think you can check whether tabster was the cause of the focus moving programmatically or if something else was the cause, can you?

from tabster.

ling1726 avatar ling1726 commented on June 3, 2024

Ah @khmakoto I see what you mean. Can you please describe the scenario where this would be needed?

from tabster.

khmakoto avatar khmakoto commented on June 3, 2024

It's for scenarios like the one in Tooltip here, where we do not want a tooltip to show if things like closing another surface would cause focus to be restored to a trigger button with a Tooltip attached to it. However, there are products that have a mixture of tabster usage + their own custom solutions for certain focus related scenarios where they sometimes move focus programmatically and would like the Tooltip to show up in those scenarios. which is impossible now because there is no way to differentiate between those.

https://github.com/microsoft/fluentui/blob/master/packages/react-components/react-tooltip/src/components/Tooltip/useTooltip.tsx#L179-L199

from tabster.

mshoho avatar mshoho commented on June 3, 2024

Tabster dispatches tabster:movefocus event every time before it moves focus. See TabsterMoveFocusEventDetail for the event's detail signature (it has next element and related keyboard event, if any). You can also can call preventDefault() and Tabster won't handle it at all (but you will have all the data about what it wanted to focus).

from tabster.

mshoho avatar mshoho commented on June 3, 2024

Tabster also adds typings for addEventListener() so that you don't need to import the event signature directly, it will be inferred automatically when you do document.addEventListener('tabster:movefocus', e => ...).

from tabster.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.