Page MenuHomePhabricator

autoedit buttons no longer support span tags in button text
Closed, DeclinedPublic

Description

MW 1.34.4, PF 5.1

Prior to PF v5.x autoedit buttons allowed html span tags in the button text. Now in 5.1 these tags are processed as displayed text. Is this the new preferred behavior?

Ref:

{{#autoedit:form=MyForm
|link type=button
|link text=<span style="font-size:2em;">EDIT</span>
|query string=MyForm[Prop1]=123
|reload
}}

(interestingly.. span tags DO work in the link text of formlinks)

Event Timeline

Revansx updated the task description. (Show Details)
Revansx updated the task description. (Show Details)

I didn't know you could put HTML in the link text before - that's interesting. If you want to change the display now, you could probably do it by putting a <div> tag, with some class set for it, around the entire #autoedit call, and then setting the CSS for it in MediaWiki:Common.css.

Declining this bug/task, although I'm not sure that there was an actual request here.

Yeah, I know there is another way to style it, but it would be nice if it still behaved that way it used to. That said, the non-explicit request was to restore said functionality, but if I understand correctly you're saying it's not a feature you ever intended and now that you know about it, you you're not inclined to make it a feature. Is that correct?

Please note that it does not support basic HTML character codes [1] either.

HTML character entities such as &checkmark; no longer renders as the pretty checkbox. Is that your preferred behavior too?

[1] https://dev.w3.org/html5/html-author/charref

#autoedit now uses the MediaWiki OOUI library (I'm moving much of Page Forms to use OOUI). Whatever the standard behavior of OOUI is, is what Page Forms will have. As for including a checkmark - given that OOUI doesn't allow it, this may require some sort of new parameter to #autoedit.

Ah. I see now how this capability was innately lost. Thanks for the background.

For now I'll probably just remove the "link type=button" option and encase the autoedit text in a div styled to look like a button. That might be the appropriate re-working required.

If someone was to someday write and submit a PR for this new autoedit parameter to be inlcuded in PF, would you accept it?

Well, it depends on how it's done, but in theory I do think it could make sense to be able to include an icon, like a check mark or a "cancel" icon, depending on what the #autoedit call does. By the way, the easiest way to add an icon to an OOUI button is by using an existing OOUI icon - you can see the full set here: https://commons.wikimedia.org/wiki/OOUI_icons

Oh, wow.. those are great! Thank you for showing me this.

My apologies for not knowing how to implement them, but can you explain how I would use one of those in an autoedit button?

You just need to add another item to the array of attributes passed in to new OOUI\ButtonWidget() - 'icon' - like:

'icon' => 'check'

Cool. I'll test it out and let you know. Thanks!

Hmm.. Not sure what I'm doing wrong. This isn't working:

{{#autoedit:form=MyForm
|link type=button
|link text=XYZ
|query string=MyForm[Prop1]=123
|'icon'=>'check'
|reload
}}

Oh, I misunderstood your question. I was talking about how to modify the PHP code.

last question for this topic .. Is it a goal of your to make the WMF OOUI icons usable in PF autoedit buttons?

I wouldn't say it's a goal, but it could be a nice feature.