Page MenuHomePhabricator

Forcefully preventing default event actions on FormLayout, ButtonWidget and ButtonInputWidget is problematic
Closed, ResolvedPublic8 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

StatusAssignedTask
OpenNone
OpenNone
OpenNone
Resolvedmatmarex
ResolvedTgr
Declinedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
Resolvedmatmarex
ResolvedJdforrester-WMF
Resolvedmatmarex
ResolvedTgr
ResolvedEsanders
OpenNone
OpenNone
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.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptFeb 27 2015, 10:37 PM
matmarex claimed this task.May 1 2015, 11:34 PM
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

Jdforrester-WMF moved this task from Backlog to Doing on the OOUI board.May 4 2015, 6:07 PM

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

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

Jdforrester-WMF closed this task as Resolved.May 11 2015, 5:14 PM
Jdforrester-WMF edited a custom field.
Jdforrester-WMF moved this task from Nominated to Done on the VisualEditor 2014/15 Q4 blockers board.
Jdforrester-WMF moved this task from Doing to Reviewing on the OOUI board.May 31 2015, 11:01 PM