Page MenuHomePhabricator

Forcefully preventing default event actions on FormLayout, ButtonWidget and ButtonInputWidget is problematic
Closed, ResolvedPublic8 Estimated Story Points

Description

FormLayout, ButtonWidget and ButtonInputWidget have a set of problems caused by preventing default event actions that make them (near) useless if you do not implement *all* behaviors on them in JavaScript. The issue doesn't affect the PHP versions, and it doesn't affect code that fully handles the events.

  • FormLayout: We prevent the 'submit' event unconditionally, which means that the underlying HTML <form> element can not actually be submitted.
  • ButtonInputWidget: We prevent the 'click' event unconditionally, which means that the button can not be used to submit a form (form 'submit' event is not fired if the 'click' event is prevented).
  • ButtonWidget: We do not prevent the 'click' event when a 'href' is given, which is problematic for progressive enhancement ('href' must be removed if the 'click' event is to be handled from JavaScript, which means that the button can no longer be middle-clicked etc.).
  • (maybe others?)

We need to allow the OOUI event handlers to decide whether the DOM events should be prevented. Making the current behavior configurable with config options would also help, but might not be sufficient?

Broken reverted attempt at fixing a part of this: https://gerrit.wikimedia.org/r/#/c/191834/

Related Objects

StatusSubtypeAssignedTask
OpenNone
OpenNone
OpenNone
Resolvedmatmarex
OpenNone
ResolvedTgr
Declinedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
ResolvedJdforrester-WMF
Resolvedmatmarex
ResolvedTgr
Resolvedmatmarex
ResolvedMarkTraceur
Resolvedmatmarex

Event Timeline

matmarex raised the priority of this task from to Needs Triage.
matmarex updated the task description. (Show Details)
matmarex added a project: OOUI.
matmarex added subscribers: matmarex, TrevorParscal.
matmarex triaged this task as High priority.
matmarex set Security to None.

Change 208389 had a related patch set uploaded (by Bartosz Dziewoński):
Simplify default action prevention in buttons and forms

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

Change 208389 merged by jenkins-bot:
Simplify default action prevention in buttons and forms

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