Commit graph

2913 commits

Author SHA1 Message Date
jenkins-bot bb31dd62e5 Merge "Implement basic Ctrl+Shift+Up/Down/Del support in new sidebar" 2021-09-27 09:08:44 +00:00
Thiemo Kreuz 58f5882957 Implement basic Ctrl+Shift+Up/Down/Del support in new sidebar
Note this patch is somewhat incomplete. The feature fully works and
I would like to see this patch merged as it is. But whenever you
press one of the keys the focus is stolen by some element on the
right side of the dialog. This makes it impossible to e.g. press
Ctrl+Shift+Down multiple times. The idea is to work on this in the
next patch.

Bug: T290262
Change-Id: Ic67f2a696c94f1e5c71134d681161221aecbfdf6
2021-09-27 08:29:12 +00:00
Adam Wight 02c637ad16 Sync panels in narrow-view mode
Reasserts scroll and highlighting when toggling the sidebar, in the
case that the other panel is hidden (narrow-view mode).

FIXME: Doesn't reassert focus because the page.focus() and
bookletLayout.focus() methods don't seem to work, maybe the bug is
especially prominent when the item to focus was already marked
active.

FIXME: Stopped working for right-to-left sync on wikitext elements.
This is a less common use case and can be addressed in follow-up.

Bug: T290975
Change-Id: I94f5709e810c63ee5fd7729a192ac7b92686b88f
2021-09-27 10:12:36 +02:00
Thiemo Kreuz f68c1e3794 Add @private tags to template dialog related methods
… obviously only to methods that are meant to be private, i.e.
only called from within the class (and possibly tests).

Change-Id: I581558078dc7210abac5f5724f71316ac45745e6
2021-09-26 11:51:36 +02:00
Thiemo Kreuz 19bb1810c4 Rename misleading updateOutlineControlButtons event and handler
The .onUpdateOutlineControlButtons() method doesn't describe what it
actually does. This issue was introduced in I9c5478a. (Intentionally,
to not make the patch to complicated.) Let's continue to rename
things to be a) unique and b) honest about what they do.

This is an alternative to I8d98e61.

Bug: T289043
Change-Id: I4d52ffa6e9e5df2025a0c33031c1517bcb421279
2021-09-26 11:50:38 +02:00
jenkins-bot 72681d45d2 Merge "Rename outline "container" widget" 2021-09-24 11:14:30 +00:00
jenkins-bot 12e6d4dd2d Merge "Unhighlight all items when highlighting" 2021-09-24 10:47:13 +00:00
Thiemo Kreuz 63d9969861 Rename outline "container" widget
I can't really tell what insight we get from the word "container".
Every widget is a "container" in some sense, isn't it?

This widget is just _the_ outline, I would argue.

Other suggestions?

Change-Id: I1fb27ee58c1a3dd790022504e978198dadf7ea02
2021-09-24 12:32:29 +02:00
jenkins-bot 654cf8c3a8 Merge "Document the 3 ways the template dialog can be opened" 2021-09-24 09:45:56 +00:00
Adam Wight bd7a1b0997 Unhighlight all items when highlighting
This prevents multiple highlighting, which was possible to achieve by clicking
sequentially in the input fields of two parameters from different templates.

Change-Id: I404936f1569ab544b693a9bc6921381636ea8f40
2021-09-24 09:26:56 +00:00
Adam Wight b94f7e02f5 Don't automatically focus the first parameter of each template
This is bad for multi-template transclusions, where we focus the
first parameter of each template ending with the last.  It's also
inconsistent, we don't do the same for wikitext chunks.

Change-Id: I720ce1a380a6f4a8618c3608b63557df5fb50393
2021-09-24 08:42:05 +00:00
jenkins-bot 8a66d01760 Merge "Prevent scrolling sidebar to heading of subitem" 2021-09-24 08:10:39 +00:00
Adam Wight 64c7859c9f Prevent scrolling sidebar to heading of subitem
Scroll was landing in the wrong place.  Subitem should be kept
on-screen after click.

Change-Id: I3c1901b7b53ac523bcc0d33172b674b97421c06d
2021-09-24 07:53:01 +00:00
Adam Wight 41bb9e95e6 Don't automatically focus first element
This was damaging the UX by causing the first parameter to be marked
as selected, but without reliably focusing it.  For example, loading
a wikitext-template-wikitext multi-part transclusion would cause the
initial focus be given to the documentation link in the template
content header.  After this patch, the focus will be at the top of
the page and tab will run down window functions and then through the
sidebar.

Change-Id: I84131870ae3887dcae74d91d68c5984d1dbffd85
2021-09-23 14:50:42 +00:00
Thiemo Kreuz 91d24bf2ec Document the 3 ways the template dialog can be opened
Change-Id: I9729eb238f4a4f0712a561b77e3d97f4e9063938
2021-09-23 16:38:33 +02:00
Thiemo Kreuz d6aece09cd Disable unwanted auto-scroll feature in template dialog
The weird auto-scroll feature is described in T289043#7297679.

This also fixes T291381 different than I393a2b1. Only one of the
patches should be merged.

Bug: T289043
Bug: T291381
Change-Id: I70d87f12fd68001e880510fb6c38d7c419d64b15
2021-09-22 13:30:37 +02:00
jenkins-bot 78c1f282c7 Merge "Always update mode on replace part" 2021-09-22 10:14:31 +00:00
jenkins-bot 228bf34ff7 Merge "Make up/down/remove buttons behave sane on …AddParameterPage" 2021-09-22 09:44:24 +00:00
jenkins-bot 0656541d7b Merge "Fix existing templates without TemplateData not showing a link" 2021-09-22 09:41:31 +00:00
WMDE-Fisch 129551d869 Always update mode on replace part
AddPart in the resetDialog also triggers replace part
so this call could be removed there.

Bug: T291365
Change-Id: Id6c0f5bf3aaece45da37ffab75a4d99c113944f6
2021-09-22 11:30:52 +02:00
jenkins-bot 34156b8cef Merge "Consolidate messages about missing/bad templates" 2021-09-22 09:15:53 +00:00
Thiemo Kreuz 4ad151c13e Fix existing templates without TemplateData not showing a link
Bug: T290140
Change-Id: Ic6d5decbf3838868e8add1b860828a784dc8af3a
2021-09-22 08:58:27 +00:00
Thiemo Kreuz 224cc9ab12 Consolidate messages about missing/bad templates
This is mostly re-arranging existing code. Actual changes made:
* Remove the message that claims a template can't exist. We can't
  really know this.
* Instead show the message about "modifiers" in cases where curly
  braces and other wikitext syntax is involved.

Bug: T290140
Change-Id: I713d7f54cad2510f9a02c113600980cba8c3e58b
2021-09-22 10:12:16 +02:00
jenkins-bot acacece321 Merge "Document optional parameter" 2021-09-22 07:40:58 +00:00
jenkins-bot 5bcde3beff Merge "Merge custom "focusin" with "set" event handler" 2021-09-22 07:21:44 +00:00
jenkins-bot 461fd05b48 Merge "Toggle the watchlist-expiry dropdown's disabled state" 2021-09-21 16:50:17 +00:00
Adam Wight 7d9a61ded7 Document optional parameter
This function can also be used to unhighlight.

Change-Id: Ic95d75dfa862951613d7c3bc21a19ec967cf9805
2021-09-21 16:36:49 +02:00
WMDE-Fisch 34cbc3f3b5 Use getTemplateDataQueryTitle to distinguish template title cases
The titles in the link cache do not include subst: anymore so to see
if these pages exist we need to use the same link title used in the
query.

Bug: T290140
Change-Id: I18de81e0bf46212c2199a948f7ca89182aa19eff
2021-09-21 12:47:02 +02:00
Thiemo Kreuz e037f99930 Merge custom "focusin" with "set" event handler
This code was introduced in I8fafee6. I can't tell any more what
the "bug" mentioned in the commit message was. Let's get rid of the
duplicate code path, see if we run into regressions and deal with
them one by one. That's much easier to handle than keeping this
confusing code path around.

Note this "focusin" event handler was actually re-implementing
parts of the upstream BookletLayout, namely
OO.ui.BookletLayout.onStackLayoutFocus().

Bug: T289043
Bug: T291381
Change-Id: Ib386ae6efec08465122f0e8ee81cd6dc9a2d337a
2021-09-21 10:14:57 +00:00
jenkins-bot 22b4c635aa Merge "Scroll template dialog element into view when pressing space" 2021-09-20 14:35:35 +00:00
jenkins-bot 58c28c13fd Merge "Improve messaging for when a template is not found" 2021-09-20 13:14:58 +00:00
Bartosz Dziewoński 86583d52e0 Toggle the watchlist-expiry dropdown's disabled state
Using the same logic as mediawiki.action.edit/watchlistExpiry.js
in MediaWiki core.

Bug: T251348
Change-Id: Ic9c67d24b5282d13de2bd496a4cb681dc9b092ac
2021-09-20 10:23:52 +00:00
Adam Wight 23e4fe240b Make function overridable by subclasses
We will hook into this from MWCitationDialog.

Bug: T291241
Change-Id: I56f006023569c65d9cd55f30856adf2f81cfbd92
2021-09-20 11:43:18 +02:00
Thiemo Kreuz 9e6def01d3 Scroll template dialog element into view when pressing space
Note there is still an issue with the upstream
OO.ui.BookletLayout.selectFirstSelectablePage() method stealing
the focus in some situations when you press space. Still this patch
already improves the situation. Pressing space on both top-level
template elements as well as parameters should scroll the thing into
view, but keep the focus in the sidebar. This was just not happening
at all.

Make sure to use a very long multi-part template to test this.

Bug: T289043
Change-Id: I9c5478a04b14b94ccd5d00480d48a7d59b4e0c37
2021-09-20 09:08:44 +00:00
jenkins-bot 866052c7b2 Merge "Fix Cite dialog failing with new sidebar" 2021-09-20 08:23:32 +00:00
jenkins-bot 4f34e9b049 Merge "Regression: Update selection in new sidebar relative to content" 2021-09-17 16:53:29 +00:00
Thiemo Kreuz 48b9a58737 Regression: Update selection in new sidebar relative to content
We broke something with the change I166b971. When we renamed that
method it started to override (and therefor disable) the method
with the same name from the base class.

I decided to move all code in the subclass for the moment. It might
be misplaced there (note how almost all code related to the new
sidebar is in the base class). But this is cleanup work for later.

Bug: T289043
Bug: T291151
Change-Id: Id255585e78967eee0f72c27727cd23211674923c
2021-09-17 16:45:24 +02:00
Thiemo Kreuz d91e356780 Fix Cite dialog failing with new sidebar
The most basic fix. The "outlined" flag is set to false for the
cite dialog, in contrast to the transclusion dialog. It's always
true for the transclusion dialog. Note it doesn't mean the sidebar
is visible, but specifies if a sidebar is created in the first
place.

Bug: T291241
Change-Id: I5a8b538949e9fd0b8e85a6a91ca2420ef72e4612
2021-09-17 16:15:20 +02:00
Thiemo Kreuz 9f783d962a Regression: Fix selection of first transclusion element
We removed this line of code in a recent patch, but it turns out
it's still necessary in at least one situation:
* Make sure you have a multi-part template where the first part is
  a wikitext snippet.
* Edit the template.
* Click the very first item in the sidebar.

Nothing happens. But the text cursor should be in the wikitext
field.

Another situation:
* Put the text cursor in the first wikitext field.
* Press shift + tab. Now a button in the bottom toolbar should have
  the focus.
* Click the 1st element in the sidebar. Again, nothing happens.

The extra .focus() call is redundant in many situations. But it also
doesn't hurt to repeat it. It will just re-focus the element that's
already focused.

Bug: T289043
Change-Id: Iccbe376b98a1b1e5469cd17e1c95d5d8869442d3
2021-09-17 14:46:06 +02:00
jenkins-bot b5388fec52 Merge "Regression: Fix broken click on top-level template elements" 2021-09-17 11:49:08 +00:00
Andrew Kostka 7165efd491 Improve messaging for when a template is not found
Bug: T290140
Change-Id: Ie43c7e2bd72ed92a8a336f6d87a54e6d51cc3f17
2021-09-17 13:39:11 +02:00
jenkins-bot 4478eb15d8 Merge "Update and fix all @param config and @cfg documentation" 2021-09-16 20:09:15 +00:00
jenkins-bot c24e6a85d9 Merge "Rename weird .onBookletLayoutSet() event handler" 2021-09-16 12:39:55 +00:00
jenkins-bot 3486d9ea58 Merge "Rename showSidebar to expandSidebar for consistency" 2021-09-16 12:36:09 +00:00
Thiemo Kreuz 0fcfa5c4aa Rename weird .onBookletLayoutSet() event handler
It was called like this because the event is literally called "set".
But it doesn't explain _what_ is set.

The new name .onBookletLayoutSetPage() already appears somewhere
else in the codebase.

Change-Id: I166b971c08f5d0fae97fc9d6244117a680f84b7c
2021-09-16 14:18:57 +02:00
Thiemo Kreuz 482f4152cc Regression: Fix broken click on top-level template elements
The previous patch Id314ee8 was incomplete. The event changed.
The id in the event is not guaranteed to be a top-level partId any
more, but can be a template parameter's id.

Note: "Parameter id" and "pageName" is the same. The fact that
these ids match is how the left and the right side of the dialog
communicate.

Bug: T289043
Bug: T291151
Change-Id: I391f0f8edb96398fd33a2e0b01003013c52776da
2021-09-16 10:48:09 +02:00
Thiemo Kreuz 921dabf895 Make up/down/remove buttons behave sane on …AddParameterPage
I realised these are vital information to make the buttons at
the bottom of the template dialog behave sane. It's still
possible to focus this page, even if it doesn't have a visible
item in any of the old/new sidebars. This is when these flags
are used to decide if the up/down/remove buttons should be
enabled.

Bug: T291151
Change-Id: I6ab709b856d110bfb37daa1592c0b6a99714aa25
2021-09-16 08:10:25 +00:00
Thiemo Kreuz cf14790450 Utilize native .isRemovable() in template dialog sidebar
The OO.ui.OutlineOptionWidget class does have an .isRemovable()
state. This is how OO.ui.OutlineControlsWidget decides if the
remove button can be used.

It appears like ve.ui.MWParameterPage forgot to mark required
parameters as not removable.

This makes some oddly specific code in ve.ui.MWTransclusionDialog
obsolete. Note how this class does not contain any other code
about "required" or other flags specific to parameters.

Note that one aspect of this patch will be visible in the old
sidebar: The trashcan will be visible on required parameters, but
disabled. It was hidden before. However, this actually improves
the UX. Hiding the trashcan made the up/down buttons jump around.
This makes it unnecessary hard to hit them. It also causes visual
distraction when navigating the list of parameters.

Let's stick to the upstream OOUI behavior.

The remove button still disappears when the only element in the
dialog is the template search widget. This is clearly an
entirely different state. (Don't ask why the up/down buttons are
not hidden. It was like this before.)

Bug: T289039
Change-Id: If78881e503f19f497f1993da4e5b9b09ee538307
2021-09-16 10:03:09 +02:00
Thiemo Kreuz dc2ce8ff59 Use OO.ui.PageLayout.setupOutlineItem instead of setOutlineItem
The separate setup method was introduced in 2014 via I7c3c133.
It appears like most of the code here was written before this
method existed. Let's update it.

* this.outlineItem is guaranteed to be set. No need for the `if`.
* The parent method is effectively abstract. There is no point in
  calling it, I would argue.
* The return value is never used. I.e. this method is never
  chained, and probably shouldn't.

Change-Id: Ida26ebdf09be74958936c3950ebdf6def9a69bc0
2021-09-15 12:18:13 +02:00
jenkins-bot fe6c46bbdc Merge "Merge "templateParameterClick" and "choose" events" 2021-09-15 10:11:12 +00:00
jenkins-bot 5c688148e8 Merge "Force delete button to be disabled on template parameters" 2021-09-15 09:30:32 +00:00
jenkins-bot 3b78f40e7a Merge "Optimize .selectPartById() to fire less events" 2021-09-15 09:07:18 +00:00
jenkins-bot 8ca4f2cc36 Merge "Change confusing property name in AddParameterPage" 2021-09-15 08:22:27 +00:00
jenkins-bot 345e1b6e09 Merge "Update AddParameterPage validation when the template changes" 2021-09-15 08:22:24 +00:00
jenkins-bot 478c95f77d Merge "Hide "required" indicator in new sidebar" 2021-09-15 07:44:58 +00:00
jenkins-bot 51eb60a81e Merge "Override default source mode font in placeholders too" 2021-09-14 21:21:47 +00:00
Thiemo Kreuz cb685d1216 Fix enter sometimes focusing the wrong template part
The behavior of the enter key in the new template dialog sidebar
is somewhat inconsistent. When pressing enter on the name of a
template it sometimes just doesn't work, but focuses something
else.

I realized this is because the message "The … template doesn't
yet exist." does not have a link. There is nothing to focus in
this element. The code just gives up and the selection returns
to whatever was selected before.

It works when there is a link in the template header. But this
is not even that useful.

Let's try to always focus the first parameter instead. The user
can still press Shift + Tab to focus the link to the template
page.

Bug: T289043
Change-Id: Id314ee8ebf47d387df08c7fb432094b6d8f7a3d2
2021-09-14 18:14:05 +02:00
Thiemo Kreuz 0f309f5b90 Hide "required" indicator in new sidebar
The previous patch I15aa2c0 (approved by UX) was incomplete. The
required indicator was still shown, depending on the skin.

This patch also reduces the amount of generated HTML when it
doesn't have an effect anyway. At the moment an empty <span></span>
is generated for _every_ parameter in the dialog. That's potentially
hundreds. But the element is only needed for deprecated and
(in the old UI) required parameters.

A missing space is added while we touch this code anyway. The
missing whitespace between label and indicator icon is confirmed to
be a bug by UX.

Styles that are the same on all skins are moved to the .css file
that's loaded for all skins. Missing word-wrapping for overly long
template parameter names (on the right side of the dialog) is added.
The position of the indicator icon was broken on Minerva the moment
a parameter name is a bit longer. Fixed by replacing `inline-block`
with `inline`.

Bug: T290492
Change-Id: Ie346d88969cec2effaf90d328d08567ab7b7bf75
2021-09-14 18:05:11 +02:00
Thiemo Kreuz 074a295a03 Change confusing property name in AddParameterPage
This kept confusing me. This is not an "input field", but a
layout container.

Change-Id: I77d8ddd4635c21512a5800f64e13e76fe08c3091
2021-09-14 17:15:55 +02:00
Thiemo Kreuz 51ad403117 Update AddParameterPage validation when the template changes
This applies in several situations. A trivial one is a parameter
that's already in use, but you uncheck it while the relevant
error message is shown. Vice versa.

Bug: T290977
Change-Id: Ia4114194a2efe34a7d51e633c776ce892cc9cb18
2021-09-14 17:13:02 +02:00
jenkins-bot 7bbdca3fb9 Merge "Avoid referencing methods via strings, take 2" 2021-09-14 14:09:35 +00:00
Thiemo Kreuz c33536112d Avoid referencing methods via strings, take 2
The first approach in patch I024ac1e doesn't work.

Change-Id: I4c9f8ef65c9e423a3e34f48483142a97ec6cef1e
2021-09-14 12:40:59 +00:00
Svantje Lilienthal 7f2821da78 Align more/less button
Bug: T290492
Change-Id: Iee160704d0875a1305ece5a4e075706e3ddb4957
2021-09-14 14:00:45 +02:00
jenkins-bot 787bc0db17 Merge "Revert "Avoid referencing methods via strings"" 2021-09-13 18:55:22 +00:00
Bartosz Dziewoński a667045383 Revert "Avoid referencing methods via strings"
This reverts commit 48283d5f19.

Change-Id: Ifc2b7fb9e9fb7deaecb6c0475db0f9253e81869f
2021-09-13 18:36:07 +00:00
Andrew Kostka a38338259d Improve input validation for the add parameter page
This patch improves the error handling for when a user tries to add
a parameter which is either an alias of a existing parameter, the
primary name of a existing aliased parameter, or a name/alias of an
existing parameter which is shown with an override label.

The error message was modified to always refer to the conflicting
parameter using the same name that is has in the sidebar.

Example: A parameter named "Parameter B" is already present in the
sidebar under its alias "B". When a user tries to add "Parameter B",
the new error message will inform the user that the parameter they
are trying to add already exists as "B".

Bug: T285869
Change-Id: I762b72b6cf14eb8ff5fcef63b4dcb70e297050de
2021-09-13 16:58:11 +02:00
Thiemo Kreuz 6680f5f141 Force delete button to be disabled on template parameters
It's impossible to use the delete button from the
OO.ui.OutlineControlsWidget to delete a parameter when the new
sidebar is active.

This partly fixes one of the issues mentioned in I97d77f4. The
delete button might stil become active for a moment (not fixed
yet), but doesn't stay active forever any more with this fix
in place.

Apparently this also makes another workaround obsolete.

Change-Id: I0bca310772c26149170af23ff8e5505c3ce4adf4
2021-09-13 16:01:25 +02:00
jenkins-bot a52cb05804 Merge "Avoid referencing methods via strings" 2021-09-13 13:28:19 +00:00
jenkins-bot 401319cb67 Merge "Split focus handling from add/remove parameter events" 2021-09-13 13:28:16 +00:00
jenkins-bot b4ac8c45ce Merge "Make "templateParameterClick" event similar to "choose"" 2021-09-13 13:24:37 +00:00
Thiemo Kreuz 48283d5f19 Avoid referencing methods via strings
Should be a bit more obvious, I hope.

Change-Id: I024ac1e2d68bfe4c5af733c48967af4c51f336c1
2021-09-13 14:26:16 +02:00
jenkins-bot 45659e2c60 Merge "Fix "add parameter" widget not being focused on click" 2021-09-13 12:25:50 +00:00
jenkins-bot 0cfd298d18 Merge "Fix and test page name splitting code in template dialog" 2021-09-13 12:23:17 +00:00
jenkins-bot 1e4ef48393 Merge "Use OOUI 'classes' property instead of .addClass()" 2021-09-13 11:46:19 +00:00
jenkins-bot bb22a6e4bb Merge "Add tests for ve.ui.MWParameterPage class" 2021-09-13 11:45:00 +00:00
Thiemo Kreuz e62b3fecbb Optimize .selectPartById() to fire less events
There is no point in firing this event when noting changed.
This should reduce flickering and some of the issues described
in I97d77f4.

Change-Id: I7c387889a4a33dac5053cec11a0641d358020b56
2021-09-13 13:42:20 +02:00
jenkins-bot 844606d573 Merge "Fix space bar on top-level template parts loosing focus" 2021-09-13 11:03:20 +00:00
jenkins-bot ebe31b5a5e Merge "Better colors when clicking/pressing elements in new sidebar" 2021-09-13 10:43:29 +00:00
Thiemo Kreuz e6f240c263 Better colors when clicking/pressing elements in new sidebar
This just copies the colors from the old sidebar.
* When hovering with the mouse (without click/press) the background
  is gray, and the text black. Relevant for readability via WCAG
  AAA.
* On click/press the background is blue (slightly darker than a
  selection), and the text is dark blue as well.

As noted in
https://docs.google.com/document/d/1V0rXMPr6upNjHF9AkROx4R8IF1LDZUzrG4K6oWT08sU

Change-Id: I443045b55826ef390688b32616dfdcfdc6555eb3
2021-09-13 11:07:22 +02:00
Thiemo Kreuz 6cb287c225 Fix space bar on top-level template parts loosing focus
As a reminder (not part of this patch): Pressing enter on the name of
a template should select it, and jump to the content area on the right.
Pressing space (that's what this patch is about) should select as well,
but not move the focus.

The best way to test the behavior is with a multi-part template.

Bug: T285323
Bug: T289043
Change-Id: I97d77f43b231696f92ba6758a6b8feac34e02e6d
2021-09-13 10:34:28 +02:00
Thiemo Kreuz aa556e3ef8 Update and fix all @param config and @cfg documentation
I tried to review all of them. Some of the changes I did:
* Make sure the `config` parameter is not marked as optional
  when it is not.
* Make sure default values are mentioned.
* List individual `@cfg` options when it makes sense.

Note I don't list all options a class could accept (e.g. via all
its parent classes and mixins). That's too much. Instead I checked
how a class is actually used and list only these options.

Even then I don't list everything, e.g. unspecific options
like "classes" that can be used pretty much everywhere.

Change-Id: Idf4fbe1dc3608ace277df9e385f2f140df3a2f50
2021-09-12 12:35:27 +00:00
Thiemo Kreuz 338a800837 Merge "templateParameterClick" and "choose" events
We don't need to distinguish between these any more. Both are
"active", i.e. both focus the widget on the right side of the
dialog. Sometimes the "choose" event is fired to actually add
or remove a parameter. Sometimes it's fired, but the state of
the parameter doesn't change (for whatever reason, i.e.
because the parameter name was clicked instead of the
checkbox). There is nothing to do in this case, except for the
focus change.

Change-Id: I3c7c0c81a075ccff76eda0a4fb2aa1ac7be3cec5
2021-09-11 17:47:08 +00:00
Thiemo Kreuz 1493aa7a35 Split focus handling from add/remove parameter events
* The template model fires an "add" event. Listeners don't
  automatically steal the focus any more.
* Instead there is a separate "focusTemplateParameterById" event
  fired from all relevant places that add a parameter.
* The "remove" doesn't steal the focus any more.

Bug: T285323
Change-Id: I93f17727524bfbcf6f11647a6c2441781337c4cc
2021-09-11 17:47:02 +00:00
Thiemo Kreuz cdc168d32a Use OOUI 'classes' property instead of .addClass()
The 'classes' property is a OOUI interface. Personally, I like
this code style better.

However. It appears like the code style in this codebase is
somewhat mixed. It looks like the top-level .$element always
uses .addClass(), while other code uses the 'classes' property.
Should we unify this?

Change-Id: I9ecd75e22d00f06ffd707f766dc9e8d748ff9a37
2021-09-11 17:41:45 +00:00
Thiemo Kreuz 22757fa901 Fix and test page name splitting code in template dialog
In JavaScript .split() behaves different, compared to PHP. In
PHP the last element contains the rest of the string. In
JavaScript the rest of the string is discarded. The limit acts
as if the array is truncated. That's why we can reduce the
number in

  'foo/bar'.split( '/', 1 )[ 0 ]

to 1, as we are only interested in the element "foo".

The same code in the other class is currently not covered by a
test. But changing it accordingly should be obviously fine now.

Change-Id: I20c27d480ddb1799df9eb1e5bc119b724e80653d
2021-09-11 17:40:39 +00:00
Thiemo Kreuz 3b59d7ce0d Add tests for ve.ui.MWParameterPage class
Change-Id: Ie09ef4745c006822cc66e845cb16f54d62fa3b7e
2021-09-11 17:39:17 +00:00
Thiemo Kreuz 7c872def9f Fix "add parameter" widget not being focused on click
When I try to click the input field, the expand/collapse button
is focused instead.

This also fixes a copy paste mistake in this class.

Change-Id: If9ab340711fbe7d88845c008360fde5df7059df0
2021-09-10 21:16:42 +02:00
Thiemo Kreuz 9b5438cba2 Hide content pane on narrow screens when sidebar is expanded
Before, the content pane (the right half of the dialog) was moved
to the right, outside of the visible viewport. But it was still
active and could i.e. be navigated to via the tab key. Only truly
hiding it solves this issue.

Bug: T274554
Change-Id: I8925a9cca0099528aca8e98452816b5f9dd23a76
2021-09-10 17:34:05 +02:00
Thiemo Kreuz ec526ea64f Make "templateParameterClick" event similar to "choose"
The original idea was to make the interface as narrow as
possible. However, it turns out it's better to model the
"templateParameterClick" event more closely after the "choose"
event.

This is split off to make reviewing the following patches
easier.

Change-Id: I271f576c6cd756cecfc6cb1fd64810f8da5c3575
2021-09-10 17:19:19 +02:00
jenkins-bot 9ef1b22b37 Merge "Clean up post- OOUI fix" 2021-09-10 14:37:12 +00:00
jenkins-bot 843aa24efd Merge "Don't allow users to add parameters that contain forbidden chars" 2021-09-10 10:14:53 +00:00
jenkins-bot 022db20850 Merge "Add input validation to the add parameter page" 2021-09-10 10:14:50 +00:00
jenkins-bot 2b7b96bbdc Merge "Remove invisible tab target from template dialog sidebar" 2021-09-10 10:00:17 +00:00
Adam Wight f8cf9e9b8e Clean up post- OOUI fix
Pure cleanup, doesn't change behavior.

Change If8da5ae85dff63c34 included in OOUI v0.42.0 tracks invisible
controls, so it's no longer necessary to maintain persistent class
variables pointing to the buttons.

Also simplify repeated logic to make it clearly exclusive.

Bug: T290554
Change-Id: If9b6404d7061999540515645fa8e50b9a21f5a21
2021-09-10 09:39:07 +00:00
jenkins-bot 38b0791ed8 Merge "Fix missing and flipped template dialog help messages" 2021-09-10 09:37:38 +00:00
Thiemo Kreuz 30d4096aeb Remove invisible tab target from template dialog sidebar
The list of parameters should remove itself from the list of
possible tab navigation targets when it's empty.

Note there is no way to remove elements from the parameter
list. That's why we don't care about "remove" or "clear"
actions.

Change-Id: I8b1215117e0ddc94f787d173e9bea6f7567d9671
2021-09-10 06:42:22 +00:00
Bartosz Dziewoński e04c9efe4e Override default source mode font in placeholders too
Depends on Ib54361bed9653ef5ba55099df4113b78794ffbdf in VE core.

Bug: T290176
Change-Id: Iea2712dc1a88f802e8b1a645ee74cc5db964e82a
2021-09-09 22:30:38 +02:00
Thiemo Kreuz 94a419e9a6 Fix missing and flipped template dialog help messages
Bug: T288465
Change-Id: I4aaa8d889084b770fa0cafab69a0b65128f3d82a
2021-09-09 16:11:00 +02:00
Andrew Kostka 97ef584e20 Rename showSidebar to expandSidebar for consistency
Bug: T274554
Change-Id: Ia0611fe10492e05e4625eb743c66eac7d0235dc5
2021-09-09 12:26:40 +02:00
Andrew Kostka 0c14b6d0bb Don't jump back-and-forth between fullscreen and floating when resizing
Previously, when the tranclusion dialog was being resized, there was
a specific width at which both the sidebar was collapsed and the dialog
was downsized from "larger/large" to "medium". This resulted in the
dialog switching from fullscreen to floating, since the dialog's width
breakpoint for "medium" doesn't match our width breakpoint for mobile.
If the user continued to downsize past this breakpoint, then the dialog
would eventually switch back to fullscreen resulting in this weird
behavior.

A simple way to prevent this is to avoid changing the dialog's size
at all. Since we don't support collapsing the new sidebar (unless
already in fullscreen), we can just leave the dialog at the
"larger/large" size.

Bug: T274554
Change-Id: I5460cdfb1a7ed73fe7957745ba37055c5f66dce1
2021-09-09 12:16:52 +02:00