Commit Graph

5 Commits

Author SHA1 Message Date
Abijeet
459d55c5d3 Remove setlang URL parameter on dialog close
Add two new options for ext.uls.dialog - afterOpen and afterClose.
These are callback function which will be triggered after the dialog
opens or closes.

Using the afterClose callback in ext.uls.setlang to remove the
setlang parameter from the URL if the dialog is closed without
pressing any button. This might happen if the user closes the dialog
by pressing Esc, or by clicking on the overlay.

Also see: Ie3215d12d9c77f15597495e21610707b272eeee9

In addition, renamed all occurrence of setlang to setLang.

Bug: T63115
Change-Id: Icaf086f947b1d91bf7ad5b36f126da0be1fc7747
2020-01-23 09:27:15 +00:00
Abijeet
5ad4f74ea9 Add support for keyboard events for the setlang dialog
Support has been added for:

* Esc: Closes the dialog
* Tab: Ensures that tabbing keeps focus on the focusable elements
  in the dialog. If no overlay is not present, the focus is
  allowed to flow normally.

This should not happen but if NO focusable elements are found and
overlay is displayed, focus is locked on the overlay.

Also add description and other license information for uls.dialog
& uls.setlang files.

Bug: T63115
Change-Id: Ie3215d12d9c77f15597495e21610707b272eeee9
2020-01-14 15:14:37 +00:00
Fomafix
5fda459531 Remove URL parameter setlang from history when language is unchanged
This change allows to use the ULS language changer without getting a
dialog for restoring the old language.

This change requires that the module is also loaded in this case.

Change-Id: Ie5169e986d0362034ede122b0bc29ce7a4aa481e
2019-12-19 20:32:25 +01:00
Fomafix
d31fddd8e7 Use history.replaceState instead of history.pushState
This removes the URL with the URL parameter setlang from the history.
A click on history back doesn't show the URL parameter setlang anymore.

Change-Id: I0ea8c4508bedd9758a1cebbe8ecb2a7113bf8538
2019-12-19 20:11:19 +01:00
Abijeet
ff02e63a45 Update setlang to display confirmation dialog to change language
setlang will now display a dialog to confirm with the user that
they would like to change their interface language. The preferred
language will only be updated if the user confirms.

The dialog will be displayed if the setlang parameter is present in
the query string and,

* A user is logged in, and their preferred language is not the same
  as the one passed via setlang.
* For an anonymous user if the wgULSAnonCanChangeLanguage is true,
  and the current interface language is not the same as the one
  passed via setlang.

Bug: T63115
Change-Id: I882297d99a594fd82fd0aec3b4664e8bfd1eac3a
2019-12-19 14:54:34 +00:00