Make WordPress Core

Opened 7 years ago

Closed 7 months ago

#40610 closed defect (bug) (fixed)

HTML5 Validation error in Screen Options > Pagination

Reported by: arena94's profile Arena94 Owned by: joedolson's profile joedolson
Milestone: 6.5 Priority: normal
Severity: normal Version:
Component: Administration Keywords: has-patch has-screenshots commit
Focuses: Cc:

Description

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

Attachments (2)

#40610.patch (781 bytes) - added by Arena94 7 years ago.
patch
40610.2.diff (800 bytes) - added by joedolson 7 months ago.
Refresh patch

Download all attachments as: .zip

Change History (11)

@Arena94
7 years ago

patch

#1 @Arena94
7 years ago

  • Keywords has-patch added

#2 @afercia
7 years 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
7 years ago

Related: #37004.

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


7 years ago

#5 @obenland
7 years ago

  • Milestone changed from 4.8 to Future Release

#6 @ocean90
5 years ago

#47530 was marked as a duplicate.

#7 @joedolson
10 months ago

  • Milestone changed from Future Release to 6.5
  • Owner set to joedolson
  • Status changed from new to accepted

This is pretty trivial; let's resolve it.

@joedolson
7 months ago

Refresh patch

#8 @joedolson
7 months ago

  • Keywords commit added

IE 11 is no longer officially supported, and removing maxlength no longer causes issues in Edge, which now behaves the same as expected with maxlength removed. LGTM.

#9 @joedolson
7 months ago

  • Resolution set to fixed
  • Status changed from accepted to closed

In 57272:

Administration: Remove invalid attribute maxlength on number input.

Remove the maxlength attribute on screen options number of items per page input. Previously kept due to input inconsistencies in IE 11 and Edge, this invalid usage is no longer needed. IE 11 is no longer supported, and Edge now behaves according to specifications.

Props Arena94, afercia, joedolson.
Fixes #40610.

Note: See TracTickets for help on using tickets.