-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
hidePopover with button click not timeout #10469
base: main
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84775,10 +84775,12 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> { | |
element.</p> | ||
|
||
<pre><code class="html"><button id=submit>Submit</button> | ||
<button id="close">Close</button> | ||
<p><output><span popover=manual></span></output></p> | ||
|
||
<script> | ||
const sBtn = document.getElementById("submit"); | ||
const cBtn = document.getElementById("close"); | ||
const outSpan = document.querySelector("output [popover=manual]"); | ||
let successMessage; | ||
let errorMessage; | ||
|
@@ -84787,7 +84789,7 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> { | |
and determining the appropriate success or error | ||
messages to use */ | ||
|
||
sBtn.addEventListener("click", ()=> { | ||
sBtn.addEventListener("click", () => { | ||
Jxck marked this conversation as resolved.
Show resolved
Hide resolved
|
||
if ( success ) { | ||
outSpan.textContent = successMessage; | ||
} | ||
|
@@ -84796,9 +84798,9 @@ dictionary <dfn dictionary>DragEventInit</dfn> : <span>MouseEventInit</span> { | |
} | ||
outSpan.showPopover(); | ||
|
||
setTimeout(function () { | ||
cBtn.addEventListener("click", () => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wonder if this is the best demonstration of manual behaviours, given that this is what popover buttons can do without JS? Perhaps a more compelling demo would be to close on keypress instead? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I think so, and same for
in that case which keypress are fine ? ESC ? that's also included in native light-dismiss. can we refine hole demo based on more meaningful concept ? e.g.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That sounds like a great idea to me. Perhaps @josepharhar has some opinions here too. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I updated whole sample based on discussion, PTLA. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah we could replace the call to showPopover with a popovertarget attribute on the submit button, assuming that the button is not supposed to be a form element submitting button. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @keithamus How about hover use-case ?
it's inspired by MUI tooltip. $div.addEventListener("mouseover", () => {
setTimeout(() => {
$tooltip.showPopover()
}, 500)
})
$div.addEventListener("mouseout", () => {
setTimeout(() => {
$tooltip.hidePopover()
}, 200)
}) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. My one concern with making a tooltip is that we're working on popover=hint and interesttarget which will do much of the same behaviour, and so I worry we'd be adding an example that may one day become redundant. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
hint and interesttarget do not seems directory related with "delay for dismiss" in my view. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. They will have configurable delays. My concern is more about the general pattern of representing a "tooltip like" component with JS that one day may not need it. There are other floating widgets we could represent, such as menus (or make an accessible toast) that are further away from the tooltip concept, and therefore more likely to stand up as an example over the coming years. Having said that; perhaps a tooltip example is fine for now and it can be something we revisit when the new features land. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Ah I missed that, got it.
I agree that, and it can be align with Living Standard manner. |
||
outSpan.hidePopover(); | ||
}, 10000); | ||
}); | ||
}); | ||
</script></code></pre> | ||
</div> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code had the popover inside of the
<output>
element instead of having the popover outside of the<output>
, but I'm not sure if that means anything with regards to the semantics of the<output>
element.