DialogTrigger with Dialog only under certain conditions #2468
Unanswered
sanbornhilland
asked this question in
Help
Replies: 2 comments
-
yes, I have same question, but seems nobody care. |
Beta Was this translation helpful? Give feedback.
0 replies
-
I would definitely use 2 buttons for this, one for enabling and another one for disabling (which would be a dialog with its trigger). |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I believe the following case has not been discussed yet. I am curious if it is sensible.
The situation is a button that can exist in two states,
enabled
ordisabled
. When clicking the button to enable, the associated action should be immediately performed. The user is not interrupted. However, disabling is potentially destructive. So if the user now clicks the button to disable they should be shown first anAlertDialog
requiring a confirmation step.Making this behaviour is straightforward if you control the
open
state of theAlertDialog
and only open in the case of disabling. However, my question revolves around the use of thearia-haspopup
attribute that is applied to theTrigger
. Using a single button element means that it will always havearia-haspopup
set but one state of the button does not in fact trigger a popup.It is unclear to me if
aria-haspopup
requires a popup to be triggered or if it means that a popup may be triggered. The WAI-ARIA Guidelines state:To me "can be triggered" suggests that a popup may be triggered but not necessarily. Does anyone have any insight here?
The alternative way to do this is to use two buttons. One for the
enable
case and one for thedisable
case. Swap them out when the state changes. But this seems to be like a disaster for focus management, accessibility (knowing what the state of the button is) etc. So it seems to me like the worse option.So my two questions are
araia-haspopup
Beta Was this translation helpful? Give feedback.
All reactions