Open Bug 1323744 Opened 8 years ago Updated 11 months ago

The setSelectionRange method called on focus event does not work every even try

Categories

(Core :: DOM: Selection, defect)

50 Branch
defect

Tracking

()

UNCONFIRMED

People

(Reporter: rmrfhome, Unassigned)

Details

(Keywords: testcase)

Attachments

(2 files)

Attached file page to reproduce
User Agent: Mozilla/5.0 (Windows NT 6.3; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.87 Safari/537.36

Steps to reproduce:

The makup: <input type="text" value="some_text" onfocus="this.setSelectionRange(0, this.value.length)" />

1) click to the input
2) click outside the input to unfocus
3) goto step (1)


Actual results:

every odd try after step (1) all text in the input will be selected
every even try after step (1) text will not be selected


Expected results:

every try after step (1) all the text should be selected
Component: Untriaged → Selection
Keywords: testcase
Product: Firefox → Core
Severity: normal → S3
Attached file foo_bar.html

I have this bug with Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:109.0) Gecko/20100101 Firefox/113.0 (it works correctly with Chromium 113).


The problem only occurs when you click on text that was previously selected.

Case that works

  1. Click on bar in the input.
  2. Click outside the input to unfocus.
  3. Goto step (1).

Every try after step (1): foo is selected.

Case that doesn't work

  1. Click on foo in the input.
  2. Click outside the input to unfocus.
  3. Goto step (1).

Every odd try after step (1): foo is selected.
Every even try after step (1): foo isn't selected.

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: