New Vector introduced a new content language selector trigger. This
code was hardcoding a behavior that works for compact language links
but is not so appropriate for other uses in the skin, which are out
of our control.
This patch aims to be a minimal change to allow other kinds of
behavior without changing the amount of tech debt. This changes
the default ULS dialog behavior to match the requirements shown
in the task. Compact language links specific behavior is retained but
only enabled for the compact language links trigger. The behavior
is chosen depending on the value of isUsingStandaloneLanguageButton().
For future changes, I propose that mw-interlanguage-selector class will
not have any styles attached to it. Whoever creates the trigger would
be in charge of styling it. Ideally that code would also define the
positioning and other behavior, but it is less clear how that can be
abstracted in a nice and decoupled way.
Bug: T276248
Change-Id: I52da6c2f5a1f25d64f322a3c8f6105da3b244b66
Changes to comments, naming and code to increase clarity of the code
and explain better what it does and why. No change in behavior.
Change-Id: I998fcfd620c2ee737618c3ab8f41fb6dfdd2c99a
Light refactor of existing code into reusable method to support
this.
Use Extension attributes to allow skins to provide ULS
additional configuration.
Bug: T274396
Change-Id: I7dcd49f05fae83fbc0c15768bee8ca93eab17bcc
Without the following changes the language button shows the
wrong label and opens a dialog with zero languages.
* Don't apply heading change to modern Vector
* Look for the element .mw-portlet-lang as well as #p-lang
Bug: T273232
Bug: T273928
Change-Id: Ic201b1983a17cc37fd1ff7c507aab656ea25f370
This provides an alternative mechanism to
I0518ecdf402ebf5eb6bad2c430f6462322c0d8e1 for loading the compact
language link module. Instead of relying on the client, the HTML
is inspected.
Bug: T264824
Change-Id: I977a998388b3e70f7fe4d97fa05be3c1ac1bf676
Example usage:
Iabd4688c6081b4de391b9655b92a16f3a414e018
We will skip loading the compact link if we don't need
to compact the languages.
Note special handling is known for Timeless which stops
propagation of events. This will be fixed in Timeless at a
later date.
Bug: T264824
Change-Id: I0518ecdf402ebf5eb6bad2c430f6462322c0d8e1
Introduced in I740600d18859422b2f98a5ef92d0321f6e9615a2.
We need to prevent the default action (navigating a link) so that
our custom code has a chance to run. Before it was synchronous so
it called location.href before default action had a chance to execute.
When it was made asynchronous, the default action got executed before
our custom code.
Change-Id: I292f99aa5f5ff536d8197174c317018462685866
Follows-up c578db02 and ea671b1f, which I thought removed
all code relating to the old async EventLogging method.
I didn't notice this UI code at the time, because I only took a
single pass over the code to find dead code. Now that that code
is gone, it is clear that the UI code is also redundant.
The mw.track() and logEvent() methods don't track the Beacon API's
async fetches, which also isn't needed, since the loss of browser
context upon navigation doesn't abort background beacons.
The loading of the EL library itself is already ensured via a
dependency so we already know there won't be an async fetch for
that.
What that leaves is some portion of older browsers in which a
EventLogging falls back to 'new Image'. This is basically just
IE 11 per <https://caniuse.com/beacon>, and for those some portion
of events will have been lost since EventLogging removed support
two+ years ago for tracking those fallback fetches via a Promise
(because of the perf issues caused by what the removed code here
was able to do).
Change-Id: Idf4378f983b6ba0e755ebadb97aa6d87cf95f7a5
As a precursor to incorporating a new language switcher in the new
version of Vector I'd like to improve the performance of loading
the switcher.
It seems most code can be deferred until the language selector
button is clicked.
This shaves around 30kb of resources off the critical path for
most users. There's potential here for a positive performance
impact so we should follow up the deployment by checking the
associated performance graphs to see if there's improvement.
Note, if the compact personal links feature is enabled
there is no performance saving for now. This will be addressed in follow
ups.
Bug: T153844
Bug: T153845
Bug: T237061
Change-Id: I740600d18859422b2f98a5ef92d0321f6e9615a2
* No status line with URL and "#".
* No new tab on middle click.
tabindex="0" ensures to have the normal tab order.
role="button" according to
https://www.mediawiki.org/wiki/Accessibility_guide_for_developers
Change-Id: I82f1923b3905f111ce7719c03a3919633271720a
Rather than building the link in JS, which is delayed until the JS
code loads, we build it in PHP and hide it from no-JS users with CSS.
Change-Id: If0c3a4dc137d8bf6cf24957dd063bd0a39791d2e
'mw' are '$' are globals, always have been, and aren't going
anywhere. They're every bit as real as their longer versions.
If anything, the longer ones are less "real" or 'stable" because
they're not used internally by RL and easier to accidentally
replace or override. For anecdotes and history, see 91f950d6b0.
Change-Id: I526fb8c961d9477992d88f2780a0ff4cbdc51923
Notable changes:
* First query global preferences to detect if global language setting
is in use. If there is no global language setting, or if GlobalPreferences
extension is not installed, it will fall back to changing the language
as usual. If global language setting is found, it will add an override
instead.
* If a local override is added, the undo tooltip is different and links to
the global preferences page. The task design shows mw.notify style popup
located on a bottom right corner (LTR). I deviate from the design and
re-use the old undo tooltip with a different message instead, for
consistency. The message is chosen depending on whether local storage
value `uls-gp` is set to '1' (set in mw.uls.changeLanguage).
* I removed one use of deprecated mediawiki.api.options module. One other
use still remains.
* I changed tooltip text generation from html acrobatics to use
mw.message.parseDom. Because of that I also had to move the click handler
to avoid buildup of click handlers.
* In message documentation fixed acronym -> autonym.
Bug: T198206
Change-Id: Ie2ed792e222be919522bd1cdea98042515a0619d
It's now possible to tab to "display settings" and "input settings"
and access them with enter or space. Also escape can now be used
to close the settings screen.
The ULS trigger in interlanguage position is a button to get
native accessibility features.
Also removed `mw.hook( 'mw.uls.settings.open' ).fire( 'uls' );` as
it didn't seem very useful and there wasn't immediately obvious
place to put it. The existing click handler could be removed because
the settings dialog themselves place event listeners.
The patch is a bit longer than strictly necessary because the CSS
was mess (rules in different modules, poorly organized) and I had
to bring related rules together to understand them.
Bug: T52793
Change-Id: Id37c2665b1c97b81ef57be27a1abfae0db6b34d5
when appearing on right side of screen
Languageselect was mostly fixed in 354378, but I forgot the
settings ones, so the triangle just disappears when
switching dialogs currently. This follows up on that and
properly fixes it.
Sidebar callouts now appear toward content regardless of
where they're appearing from, or the language
directionality. Triangles are now consistently alligned to
the top of the callout (same position in languageselect and
compact language links) to avoid issues with it appearing
over a scrollbar.
Sideways callout triangles (carets) are consolidated into a
single rendering approach and mixin across compact language
links and toolbox language selector.
Bug: T161586
Change-Id: I7717e26525ac527ede486796f49083ed40ee7d4f
This fixes the same issue as 1d395d4966,
but for the little language change popup (shown after you change the
language) instead of the main interface.
Change-Id: I28d3e8baeebf4619f4f810869c8a2a3fb60496d9
Follow-up to 1d395d4966. We were
measuring the wrong $window, which happened to work right most
of the time but wasn't correct.
Change-Id: I50f91623b304f43be58ebac844d507757f56db45
For interlanguage toggle, interlanguage position is no longer assumed to be a
left sidebar, and is determined on the fly in order to appear correctly
regardless of where it is, and not go off the side of the page. This works
across most skins, and regardless of language directionality.
Does not necessarily resolve issues with interlanguage links appearing in the
middle of the page (header/footer), or the callout just plain not fitting for
other reasons (mobile devices).
bug: T161586
Change-Id: Icd55498a945e12c0ff79ba891c094d60ce791115
Use OOjs UI PopupWidget's new built-in positioning to position
the popup relative to the ULS trigger.
Bug: T161203
Change-Id: I3af45e2e3dbaea5f2e6435dd919a8bc7374e486e
This change is the JavaScript part of change
I54a18f5bd85a8261a25e1160dda7a33fbdf3dd7b.
This change should get deployed when the HTML caches of change
I54a18f5bd85a8261a25e1160dda7a33fbdf3dd7b has expired.
Change-Id: Id7f429d9d1217316341102e27389711525f17b2d
Especially on Special:CX, where page layout changes soon after load
(for example scrollbars get added when more content loads), the tooltip
would be positioned incorrectly. Now it is more likely to be positioned
correctly, and will get re-positioned again if it is shown again after
being hidden.
Bug: T145483
Change-Id: I527fc62b196e55101950cffcc6ec43926f63aa4a
The tipsy class has CSS styling from the tipsy module which do
not work with the OO.ui.PopupWidget. If the tipsy module gets
loaded for some other reason, the display will be slightly broken.
Fixed by renaming the class.
Bug: T96648
Change-Id: Ib0e11098506560f4de1c6402b8c980ad3ebc3879
This doesn't appear to be justified due to the one use case. This
will now be done via OOjs UI and given jquery.tipsy is deprecated
it is better to replace it (T117720).
Bug: T119417
Bug: T102922
Change-Id: I60cce248884308bf0728d153f6137a8d25e01300
Now that Compact Language Links also started to add to this list, ULS would
show incorrect language change tooltip notifications. ULS interface language
selection will still keep updating the list of previously selected languages.
Refactored the code a bit: 1) created minimal Store that wraps around plain
localStorage, since mediawiki.storage cannot be used yet. 2) Inlined the
userHasChangedLanguage function to new initTooltip function. 3) Split parts
of the huge initInterface to new initTooltip and initIme functions for
increased readability. 4) Solved a TODO for moving language change recording
out of the tooltip showing code.
Change-Id: If8478a59168d89264f4d46938ac865c0c9a04f25
This is already expected by the callers. Added addPreviousLanguage
to make updating the list easier.
Change-Id: Ie4f888235ea4de4a2ce6bf5a9f24955e423e8c48
jquery.uls.compact module is kept for now as some other
extensions depend on it. But it does not do anything
anymore.
There are some styles which should be in jquery.uls
upstream, but given the current state that is easiest
done in a follow-up later.
The main change is that language selection is now
compact by default: no heading etc.
Includes style changes for the dialogs, and especially
for the new position of the callout caret.
Bug: T85519
Change-Id: Iade8005439b4f58ab241752f69a5365d8bb88d2c