-
Notifications
You must be signed in to change notification settings - Fork 299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Popover API can't be used with the LionButton #2040
Comments
Is there a particular reason for using a div instead of a button for LionButton? If there isn't a specific reason, I recommend changing it to a button element and resetting the CSS styles accordingly. What's peculiar is that when you view the StackOverflow code snippet and run it, it doesn't allow you to open it but will close if you click the div. |
The reason for can be found inside LionButton.js
But to be able to use the popover API would be nice, so definitely something to consider. |
In the LionButton, the comment starts with "Use LionButton (or LionButtonReset|LionButtonSubmit) when there is a need to extend HTMLButtonElement." However, LionButton does not actually extend the HTMLButtonElement; instead, it creates a div with certain properties. To address this and align with the intended purpose of extending HTMLButtonElement, we will need to make the following change: From: return html` <div class="button-content" id="${this._buttonId}"><slot></slot></div> `; To: return html` <button class="button-content" id="${this._buttonId}"><slot></slot></button> `; Moreover, as we switch to the Is there a reason we don't do this? |
Hey, interesting issue 👍 It's a pity indeed that the popovertarget attribute only works on HTMLButtonElement/HTMLInputElement... Little background...
As you can see, building an accessible button that works for every single use case isn't that easy 😅 Now on to the popovertarget
|
Expected behavior
Being able to use the popover API with the LionButton
Actual Behavior
The popover api can't be used, because the native button element isn't used. Here it states that only the native button and input element can used to trigger a popover.
This stack overflow post has a stripped version of the LionButton and displays the issue. https://stackoverflow.com/questions/76682796/use-popover-api-with-div-role-button-as-invoking-element/76700614#76700614
Additional context
lion: 0.3.4
The text was updated successfully, but these errors were encountered: