html icon indicating copy to clipboard operation
html copied to clipboard

hidePopover with button click not timeout

Open Jxck opened this issue 1 year ago • 6 comments

as mentioned by @keithamus at https://github.com/whatwg/html/issues/10428#issuecomment-2186785118 closing popover with timeout (time based UI) is not in conformance with WCAG 2.2.3.

But the current sample code in the spec expresses it. so it should be replaced with "explicitly closed manner".

I respect the current code as-is and adding minimal fixes. If I can refuctoring whole code (indentation, id name, code flow etc), I'd love to do that too.

Thanks Jxck


/popover.html ( diff )

Jxck avatar Jul 10 '24 18:07 Jxck

for ease of review

<img id="image" src="cat.js" alt="pretty kitten">
<div id="tooltip" popover>
  <output></output>
  <button popovertarget="message" popovertargetaction="hide">x</button>
</div>

<script>
  const $img = document.querySelector("#image")
  const $tooltip = document.querySelector("#tooltip")
  const $output = $tooltip.querySelector("output")

  $img.addEventListener("pinterover", () => {
    $output.textContent = $img.alt
    $tooltip.showPopover()
  })
  $img.addEventListener("pinterleave", () => {
    $tooltip.showPopover()
  })
</script>

Jxck avatar Jul 17 '24 09:07 Jxck

@keithamus any other comments ?

Jxck avatar Aug 05 '24 05:08 Jxck

I'm not a fan of the php style $ at the beginning of variable names and lack of semicolons at the end of lines, but I'm not sure if there is any such style guide for the HTML spec example code.

josepharhar avatar Aug 09 '24 17:08 josepharhar

To avoid extra effort, we would like to avoid modifications based on someone's preferences. Can I have a style guide for here ?

Jxck avatar Aug 11 '24 15:08 Jxck

To avoid extra effort, we would like to avoid modifications based on someone's preferences. Can I have a style guide for here ?

I don't think there is a style guide and I'm not an editor of this spec, so I'll defer to the editors for this.

josepharhar avatar Aug 13 '24 20:08 josepharhar

@josepharhar it's been done for now. PTL again plz.

Jxck avatar Oct 13 '24 20:10 Jxck