Skip to content

SnapLinks doen't work in checkbox with pointer-events none #552

@matheusroberson

Description

@matheusroberson

Hi,

While testing SnapLinks, I noticed an issue related to checkboxes that have pointer-events: none.

Observed behavior

  • A checkbox with pointer-events: none is not detected/selected by SnapLinks.
  • However, if the same checkbox is wrapped inside a <label> element, SnapLinks works as expected.

Minimal example

<input checked type="checkbox" value="0" style="pointer-events: none;">
Checkbox with pointer-events: none
<br>

<label>
  <input checked type="checkbox" value="0" style="pointer-events: none;">
  Checkbox with pointer-events: none inside a label
</label>

Possible cause

The issue may be related to this condition in content-scripts/ElementIndexer.js:

if (elPoint != elem && !elem.contains(elPoint) && elPoint.tagName !== 'LABEL')

Reproducible demo

https://codesandbox.io/p/sandbox/funny-elion-wqpf2r

Additional notes

  • I'm happy to help investigate or test potential fixes if needed.
  • I was testing 3.1.16 version

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions