Make WordPress Core

Opened 10 years ago

Closed 10 years ago

#20420 closed defect (bug) (fixed)

maxlength attribute not working on new input[type=number]

Reported by: tbuteler's profile tbuteler Owned by: nacin's profile nacin
Milestone: 3.4 Priority: normal
Severity: trivial Version: 3.4
Component: General Keywords:
Focuses: Cc:


I don't know if this categorizes as a WP bug or just browser bugs, but the maxlength attributes on the "div.screen-options input.screen-per-page" elements is not working after the upgrade to 3.4 changed their type from "text" to "number".

As tested on the latest versions of Chrome, Safari and Opera (which render a spin box on the left of the element), you can have any number you want inside the box. Firefox, which relies solely on keyboard input, is the only one that honors the maxlength of 3.

If this change was decided so that iOS users can have a numeric keyboard, this seems to provide an alternative:

Attachments (1)

20420.diff (683 bytes) - added by georgestephanis 10 years ago.

Download all attachments as: .zip

Change History (6)

#2 @nacin
10 years ago

  • Milestone changed from Awaiting Review to 3.4

#3 @georgestephanis
10 years ago

Would max="999" on the input not work? (if we're capping it at a length of 3)

#4 @nacin
10 years ago

We only use maxlength in a few places. This is the only instance of maxlength + type="number". Forcing it to 999 works, as that's what we sanitize on the PHP side.

#5 @nacin
10 years ago

  • Owner set to nacin
  • Resolution set to fixed
  • Status changed from new to closed

In [20625]:

Add a max of 999 to the screen options items per page input. props georgestephanis. fixes #20420.

Note: See TracTickets for help on using tickets.