Page MenuHomePhabricator

Progressive buttons broken in OOUIHTMLForm
Closed, ResolvedPublic

Description

Default:


OOUI:

Screenshot made at Special:OAuthManageMyGrants/update.

Event Timeline

Tgr created this task.Jun 19 2015, 2:22 AM
Tgr raised the priority of this task from to Needs Triage.
Tgr updated the task description. (Show Details)
Tgr added a project: MediaWiki-HTMLForm.
Tgr added a subscriber: Tgr.
Restricted Application added a subscriber: Aklapper. · View Herald TranscriptJun 19 2015, 2:22 AM
Tgr added a comment.Jun 19 2015, 2:26 AM

Not sure if this is the same as T98903? The button is created via

$form->addButton( 'update',
	$this->msg( 'mwoauthmanagemygrants-update' )->text(),
	null,
	array( 'class' => 'mw-ui-button mw-ui-primary' )
);
Tgr added a comment.Jun 19 2015, 7:39 PM

Same for destructive buttons (e.g. Special:OAuthManageMyGrants/revoke).

Cherry-picking https://gerrit.wikimedia.org/r/#/c/218149/1 does not help, so this is probably an unrelated bug.

Hmm. The current code results in a plain OOUI button with additional 'mw-ui-button mw-ui-primary' CSS classes, which obviously doesn't work well. We should either try to "parse" the 'class' attribute and convert some magic classes to OOUI\ButtonInputWidget 'flags' config option, or allow passing flags to addButton() somehow and update callers. Not sure which would make more sense.

Tgr added a comment.Jun 19 2015, 11:10 PM

I don't know which is easier to implement, but from a distance, passing flags certainly sounds cleaner.

Hmm. It seems that you should already be able to do it. Does passing array( 'flags' => array( 'primary' ) ) instead of array( 'class' => 'mw-ui-button mw-ui-primary' ) give the desired result?

(You'll actually want array( 'flags' => array( 'primary', 'progressive' ) ); OOUI 'primary' flag doesn't include 'progressive' flag, unlike MediaWiki UI.)

Tgr closed this task as Resolved.Jun 27 2015, 5:49 PM
Tgr claimed this task.

That works, thanks!