Page MenuHomePhabricator

Visual Editor wgVisualEditorSkinToolbarScrollOffset seems to not work properly with Chameleon fixed header
Open, Needs TriagePublic

Description

Apologies in advance if this is not a bug and I am doing something incorrectly. I am trying to use VE with Chameleon and when using a fixed header, the VE toolbar appears correctly under the fixed navbar, but when I scroll the page the toolbar disappears under the header. I would think that if wgVisualEditorSkinToolbarScrollOffset is set to the height of the navbar, the VE toolbar should remain fixed below the navbar while floating and scrolling. However, it appears to only shift down the contents of the article in the editor and doesn't keep the navbar positioned.

I created a simple fix, but I am unsure if this is a VE bug, or if I am actually just using this configuration directive incorrectly. I've attached the revision here in case it is of any use to the project. If I am approaching this issue incorrectly in the first place and this change could introduce other problems I'm not aware of, it would be helpful to know that as well if possible.

Event Timeline

I don't remember when this was added, but I think you're supposed to set the toolbar's position in CSS as well, like this in Timeless: https://github.com/wikimedia/mediawiki-skins-Timeless/blob/master/resources/extensions/VisualEditor.core.less#L10 (which, curiously, doesn't set VisualEditorSkinToolbarScrollOffset…).

@Chrishel Have you had the time to try setting the position in CSS?

I tried using that css setting, and it seems like it could work but I'm having issues with the order of evaluation of style properties. It looks like that when visual editor is loaded, it sets the top to 0 via an embedded style tag which gets evaluated after my skin's scss file and thus VE's default value always overwrites what I try to set. If I use chrome's developer tools and disable the top property from the style tag so that my skin's value for top becomes active, it works. I'm not sure the most efficient way to be able to overwrite VE's value for this property if this is going to be considered the ideal solution for this problem moving forward.

Also, it looks like Chameleon at one point was trying to accomplish a similar css fix, but commented it out for some reason (https://github.com/ProfessionalWiki/chameleon/blob/master/resources/styles/_extensionfixes.scss#L23). Regardless, it seems like the toolbar doesn't position properly out of the box for Chameleon, so it seems like this issue remains unfixed for them?

You all obviously have a much better sense of the big picture, but it seems to be that since a VisualEditorSkinToolbarScrollOffset configuration directive exists which appears to be designed to solve this problem, the better solution might be to just fix that directive to function as intended rather than skins having to use their own css fixes which conceptually overlap with this directive? The downside to this approach seems to be that it's a bit inelegant to have to define a style property (i.e. the navbar height) in the PHP code of the skin rather than being able to handle everything in scss.

@Chrishel The recommended way is to put that rule in a separate CSS files, then put it in 'ResourceModuleSkinStyles' fo the module you want to override, like this: https://github.com/wikimedia/mediawiki-skins-Timeless/blob/master/skin.json#L100

If this is inconvenient (I guess it might be with SCSS?), then I'd just use !important ;), or increase the selector specificity.

The Editing team hasn't heard anything back regarding this task so we are moving it to the freezer.