Make WordPress Core

Opened 14 months ago

Last modified 13 months ago

#40610 new defect (bug)

HTML5 Validation error in Screen Options > Pagination

Reported by: Arena94 Owned by:
Milestone: Future Release Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch has-screenshots
Focuses: Cc:


Error: Attribute “maxlength” is only allowed when the input type is “email”, “password”, “search”, “tel”, “text”, or “url”.

Attachments (1)

#40610.patch (781 bytes) - added by Arena94 14 months ago.

Download all attachments as: .zip

Change History (6)

14 months ago


#1 @Arena94
14 months ago

  • Keywords has-patch added

#2 @afercia
14 months ago

  • Keywords has-screenshots added
  • Milestone changed from Awaiting Review to 4.8
  • Version trunk deleted

@Arena94 thanks for your patch.

Looking back for some history, this input type was changed from text to number in [20168], see #17863. Seems the maxlength attribute was kept for some backwards compatibility concerns. However, the next 4.8 release is going to drop support for old IEs so maybe worth considering to remove it.

Worth noting seems browsers have all sorts of different behaviours, most of them allow to enter more than 3 characters ignoring the max="999" and maxlength="3" attributes when manually entering numbers, regardless of the presence of the attribute (it only works when the input type is text).

As far as I see, removing maxlength="3" makes some difference just in IE11 and Edge. With maxlength="3" it's not possible to manually enter more than 3 numbers. Without maxlength="3" it becomes possible. It is always possible when the entered value starts with an alpha character.

Chrome Mac (doesn't honor max and maxlength when manually entering numbers) https://cldup.com/eUK-6h-Q93.png

Firefox Mac (doesn't prevent alpha characters input, doesn't honor max and maxlength when manually entering numbers) https://cldup.com/QQHEBwpDyL.png

IE11 (doesn't prevent alpha characters input, doesn't honor max and maxlength when entering a mix of alpha characters and numbers) https://cldup.com/c59l4SjesH.png

Edge (same as IE11 plus doesn't honor max when incrementing the field value using the up arrow) https://cldup.com/gVgUtQ2qHU.png

Moving to 4.8 consideration.

#3 @afercia
14 months ago

Related: #37004.

This ticket was mentioned in Slack in #core by obenland. View the logs.

13 months ago

#5 @obenland
13 months ago

  • Milestone changed from 4.8 to Future Release
Note: See TracTickets for help on using tickets.