Page MenuHomePhabricator

NumberInputWidget is not actually an InputWidget
Closed, ResolvedPublic

Description

It has various incompatibilities, such as setValue not being chainable and having no focus method.

Also, validation should be optional.

Event Timeline

Krenair raised the priority of this task from to Needs Triage.
Krenair updated the task description. (Show Details)
Krenair added a project: OOUI.
Krenair subscribed.

Change 268375 had a related patch set uploaded (by Prtksxna):
OO.ui.NumberInputWidget: Extend InputWidget instead of Widget

https://gerrit.wikimedia.org/r/268375

Doing this is a bit tricky since the NumberInputWidget uses the TextInputWidget's validity methods. This makes it hard for it to use its own normal <input> element. I think apart from the hack above we have two options:

  • Make NumberInputWidget implement all the InputWidget methods but not actually extend it.
  • Create a Validity mixin that makes it easier for all widgets to add this functionality.
Jdforrester-WMF triaged this task as Medium priority.
Jdforrester-WMF set Security to None.

Change 268375 abandoned by Prtksxna:
NumberInputWidget: Extend InputWidget instead of Widget

Reason:
Will come back to this once I3d60fb and I94e35d are merged, and TextInputWidget is leaner.

https://gerrit.wikimedia.org/r/268375

Change 349125 had a related patch set uploaded (by Mooeypoo):
[oojs/ui@master] NumberInputWidget: Remake as an actual TextInputWidget child

https://gerrit.wikimedia.org/r/349125

@Prtksxna Are there considerations from your side about the latest patch, that might not have been resolved as https://gerrit.wikimedia.org/r/#/c/284168/ (I94e35d) hasn't got merged yet?

Prtksxna added a subscriber: Mooeypoo.

@Prtksxna Are there considerations from your side about the latest patch, that might not have been resolved as https://gerrit.wikimedia.org/r/#/c/284168/ (I94e35d) hasn't got merged yet?

I think we're good. I was planning on making NumberInputWidget inherit from InputWidget in which case, I am not sure why I added that issue/patch as a blocker. @Mooeypoo's patch on the other hand makes it inherit from TextInputWidget, while this should not be a problem, it gives NumberInputWidget some unnecessary config params.

Change 349125 merged by jenkins-bot:
[oojs/ui@master] NumberInputWidget: Remake as an actual TextInputWidget child

https://gerrit.wikimedia.org/r/349125

Volker_E moved this task from Reviewing to OOjs-UI-0.21.2 on the OOUI board.
Volker_E edited projects, added: OOUI (OOjs-UI-0.21.2); removed: OOUI.
Volker_E removed a project: Patch-For-Review.