mirror of
https://gerrit.wikimedia.org/r/mediawiki/extensions/VisualEditor
synced 2024-11-16 10:59:56 +00:00
7dae6496b3
We don't have a FOUC on the appearing of the 'edit' link. That one is handled quite intelligently: * Via the stylesheet that is also loaded in noscript mode, its (hidden) appearance is already predetermined. So as soon as those elements are seen by the browser they style correctly for users without JavaScript (display: none). * This same stylesheet also hides it for users with JavaScript but where VE is not available (e.g. due to browser support). While ve-not-available is added very early on (before document ready), it could in theory cause a short FOUC, but that's okay. We simply don't know that VE isn't supported until then. We optimise for the common case (JavaScript enabled, VE available), while still ensuring that it is always hidden in noscript, and is hidden as soon as possible when VE turns out not to be available. For some reason, one small detail (the little bit of whitespace added inside the brackets), was left out of this and was implemented by adding the class 'mw-editsection-expanded' to them from a document ready handler. * First step, get rid of the script that adds this class and use ve-available instead. That means they're styled correctly much earlier (we add the class to <html> before document ready). This can still cause a brief FOUC, though in most cases they're correct from the start. * Step two, make brackets expand by default for script users, and let ve-not-available reset it. This way, like with edit tabs, a FOUC will never happen for ve-available. And even for ve-not-available, a FOUC is rare since we add it before document ready via <html> look-ahead styling. There was still a brief reflow jump because of negative margins between two paint events. One was undoing the other at a later time. These negative margins are a remnant of when we were doing animations (follows-up I4b9c47fd65a70). They were added to reduce reflows and content shift, but were now actually causing them. Removed "padding-right" from mw-editsection, and negative margin from the brackets. Also: * Don't add inline 'style="direction: ltr;"' on every single editsection throughout the DOM. This was the only operation we were doing unconditionally. While I doubt the need of it in general, we can at least allow MediaWiki to do it right, and only add the override if needed. This saves quite a few DOM operations. Change-Id: I7a729edc2cd4a66ebc0ad6935ffd02cb9b948bff
43 lines
1.3 KiB
CSS
43 lines
1.3 KiB
CSS
/*!
|
|
* VisualEditor MediaWiki ViewPageTarget noscript styles
|
|
*
|
|
* @copyright 2011-2014 VisualEditor Team and others; see AUTHORS.txt
|
|
* @license The MIT License (MIT); see LICENSE.txt
|
|
*/
|
|
/*csslint ids:false */
|
|
|
|
/* Hide VE edit tab and section edit things for noscript users.
|
|
* For script users they're always visible unless and until ve-not-available is added.
|
|
*/
|
|
.client-nojs #ca-ve-edit,
|
|
.client-nojs .mw-editsection-divider,
|
|
.client-nojs .mw-editsection-visualeditor,
|
|
.ve-not-available #ca-ve-edit,
|
|
.ve-not-available .mw-editsection-divider,
|
|
.ve-not-available .mw-editsection-visualeditor {
|
|
display: none;
|
|
}
|
|
|
|
/* For script users, expand brackets by default, unless and until ve-not-available is added */
|
|
|
|
/* @noflip */
|
|
.client-js .mw-content-ltr .mw-editsection-bracket:first-of-type,
|
|
.client-js .mw-content-rtl .mw-editsection-bracket:not(:first-of-type) {
|
|
margin-right: 0.25em;
|
|
color: #555;
|
|
}
|
|
|
|
/* @noflip */
|
|
.client-js .mw-content-rtl .mw-editsection-bracket:first-of-type,
|
|
.client-js .mw-content-ltr .mw-editsection-bracket:not(:first-of-type) {
|
|
margin-left: 0.25em;
|
|
color: #555;
|
|
}
|
|
|
|
/* Must have the same, or higher, specificity (4x class/pseudo-class) as the rule above */
|
|
.client-js.ve-not-available .mw-content-ltr .mw-editsection-bracket,
|
|
.client-js.ve-not-available .mw-content-rtl .mw-editsection-bracket {
|
|
margin-left: 0;
|
|
margin-right: 0;
|
|
}
|