microsoft / tabster

Web Application Keyboard Navigation Tools
https://tabster.io
MIT License
119 stars 36 forks source link

[Deloser] Add inert property #394

Closed mshoho closed 2 months ago

mshoho commented 2 months ago

Deloser currently works automatically. It tracks focus history inside and restores focus if it is lost.

From the ability to control that behaviour programmatically we have tabster:movefocus custom event. The subscribers of this event can call preventDefault() whenever Deloser wants to restore focus, to prevent the default behaviour. We also have tabster:deloser:focus-lost dispatched when Deloser registers lost focus. And we have tabster:deloser:restore-focus event which could be dispatched by the application to force Deloser to restore focus using focus history.

To complete the adjustability of the Deloser behaviour let's add inert property, so that it can just track history and the application would be deciding if it wants to restore focus or not. This is currently doable by creating tabster:movefocus custom event handler, but having a prop would be add extra convenience and declarativity of the API.

Within this task we also need to cover the Deloser programmatic control with a bunch of tests.

mshoho commented 2 months ago

OMG, this is already done with Deloser.strategy...