chameleon icon indicating copy to clipboard operation
chameleon copied to clipboard

Form edit button and regular edit button cannot both be pulled out of menu

Open Shepard opened this issue 5 years ago • 4 comments

When using the Page Forms extension and a form is defined for a category used on a page, a button "edit with form" should appear in the page tools. This works with the vector skin but with chameleon I don't get that button. Also, the regular edit button is suddenly moved into the "..." menu of the page tools even though it should be pulled out into the navigation area by default (which also works on other pages not using forms).

I tried to explicitly define the buttons as being pulled out in my layout file like this (since I saw "formedit" mentioned in the documentation) but it didn't make any difference:

<component type="NavbarHorizontal">
	...
	<component type="PageTools" class="flex-row" position="right" hideSelectedNameSpace="yes" buttons="formedit,edit"/>
	...
</component>

I'm using: MediaWiki 1.31.0, PHP 7.2.19, Chameleon 2.0, Page Forms 4.5.1

Shepard avatar Jul 21 '19 09:07 Shepard

Sorry, I only just saw that this was fixed for #87 / #89. I updated to Chameleon 2.1 and now I get the formedit button!

However there's still a small issue: The way I defined my layout file as seen above I'd expect to see both the formedit and the edit button outside of the "..." menu. However, only the formedit button gets pulled out when there's a form. The edit button stays in the menu. For pages without forms, the edit button outside of the menu just fine.

Shepard avatar Jul 21 '19 10:07 Shepard

However, only the formedit button gets pulled out when there's a form. The edit button stays in the menu.

This is exactly what I experience as well, with MW 1.34.2 and Chameleon 3.0.1. The edit (source) button is very helpful for sysops and it would be great to see it directly.

As a test I commented out my PageForms section in LocalSettings.php (with viewedittab permissions and $wgPageFormsRenameEditTabs) but that didn't pull out the edit button from the menu.

stefahn avatar Jul 24 '20 09:07 stefahn

I've run into this now and need to solve it. The issue here is that the default value, or the explicit value edit, leads to unexpected/undocumented behavior. According to the code when the value edit is provided it will end up showing only the first button for all available edit buttons (form edit, visual edit, source edit) and the rest will remain in the menu. The practical effect of this is when a page is linked to a form it will always show only the formedit button.

Fixing this is not too difficult, however the problem is the current behavior has been there since Chameleon 2.0 (2019). The implementation makes it seem like it is intentional (i.e. something like "show only the most appropriate edit button"), but it is unexpected (to me, anyway). At this point the bug has become a feature and it won't be safe to change the default behavior in 3.x since that would affect existing installations. This might be something to break in 4.0, but for now I propose adding another attribute, something like singleEditButton="no" which will disable the undocumented grouping of the edit buttons. The default value for the new attribute will be yes in order to preserve existing behavior.

This is what'll happen with my proposed change:

<component type="PageTools" position="right" hideSelectedNameSpace="yes" buttons="formedit,edit" singleEditButton="no" />

image (I would suggest using different icons when displaying more than 1 edit button, but that will have to be a user override.)

Does anyone here have any thoughts on this?

malberts avatar Aug 08 '21 20:08 malberts

"show only the most appropriate edit button"

This exactly. Why would you want the raw edit, if a form exists? Well, at least that was my thinking back then. Sorry. :shrug:

Maybe you could show both buttons if "formedit" and "edit" are both explicitly requested and keep the mechanism when only "edit" is requested? I still think on normal wikis you would want the user to see the form, if one exists.

Edit: If you remove the mechanism completely, Chameleon will not work out of the box with Page Forms or Visual Editor.

s7eph4n avatar Aug 08 '21 22:08 s7eph4n