[popups] Rework modal
prop
#1554
Labels
component: dialog
This is the name of the generic UI component, not the React module!
component: popover
This is the name of the generic UI component, not the React module!
enhancement
This is not a bug, nor a new feature
new feature
New feature or request
Feature request
Summary
Discussion starting at #1459 (comment) (@vladmoroz)
The word
modal
is quite overloaded and confusing, since there are actually three different user inputs that can be "modal", which can have varying combinations of being on or off:focus
— you can't focus anything behind (i.e. except what's in) the popup while it's openscroll
— you can't scroll anything behind (i.e. except what's in) the popup while it's openpointer
— you can't click anything behind (i.e. except what's in) the popup while it's openTypically when people say something is "modal", they mean all three are modal simultaneously, such as in the case with most dialogs that are positioned in the center of the screen, have a dimming backdrop, and aren't anchored to another element.
But it can be desirable to have a popover be "non-modal" (with respect to pointers) but still trap focus, i.e. be modal to keyboard focus.
Instead of the
modal
prop, I proposed the less-overloaded wordtrap
instead, typed asboolean | TrapOptions
:Although "lock" is typically used for scroll modality, and "pointer" doesn't really have a word describing its modality, I think
trap
correctly describes what's happening to all three user inputs:Combinations
One of the problems with this config object is that some combinations lead to an incoherent user experience.
trap
valuefocus: true
|scroll: true
|pointer: true
focus: true
|scroll: true
|pointer: false
focus: true
|scroll: false
|pointer: true
focus: true
|scroll: false
|pointer: false
focus: false
|scroll: true
|pointer: true
focus: false
|scroll: true
|pointer: false
focus: false
|scroll: false
|pointer: true
focus: false
|scroll: false
|pointer: false
The text was updated successfully, but these errors were encountered: