lcdsantos / lcdsantos/jQuery-Selectric

Click event does not fire on nested elements inside li tags

Open
#236 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
715
Forks
149
PR merge metrics
No merged PRs in 30d

Description

When using the optionsItemBuilder function and add new tags, click event does not fire on new elements. It happens because return false; in this part of the code

_this.$li.on({
  // Prevent <input> blur on Chrome
  mousedown: function (e) {
    e.preventDefault();
    e.stopPropagation();
  },
  click: function () {
    _this.select($(this).data('index'));

    // Chrome doesn't close options box if select is wrapped with a label
    // We need to 'return false' to avoid that
    return false;
  }
});

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Search the optionsItemBuilder implementation for the shown _this.$li mousedown and click handlers, then reproduce the problem with a nested element inside an li. Check that clicks on nested elements fire while preserving input blur prevention and label behavior; done means the new elements respond to clicks without breaking option selection.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, jquery
Domain
frontend
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.