Skip to content

JS error when focusing a numeric field with auto-select logic #89

@stracker-phil

Description

@stracker-phil

Description:

Only while the WebPilot Chrome Extension is active, there is a JS error in the console when focusing a text field with type=number that runs this.select() on focus/click/etc

Console Error:

Uncaught DOMException: Failed to execute 'setSelectionRange' on 'HTMLInputElement': The input element's type ('number') does not support selection.

Steps to replicate it:

  • Make sure the Chrome Extension is active for all websites
  • Create a HTML page with the following content: <input type="number" onclick="this.select()" value="1234" />
  • Click into the text field. You'll get a JS error, and the number is not selected
  • To verify it's WebPilot: Disable the browser extension and try again

Test URL: https://output.jsbin.com/jacaret

Possible source of problem:
https://github.com/webpilot-ai/Webpilot/blob/0874189cade6add978473d9d6146782fda3150f2/src/utils/index.ts#L85C2-L85C2

Related StackOverflow discussion:
https://stackoverflow.com/q/33406169/313501

Screenshot (gif)
2023-11-06_12-29-30 (1)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions