Commit graph

498 commits

Author SHA1 Message Date
Svantje Lilienthal 143dee9a1d Close popup when clicking enter
Bug: T341874
Change-Id: I8cafbc93a87d168a428b2e9e46a60ea812ae584c
2023-08-29 16:13:33 +02:00
jenkins-bot 24ca67ff10 Merge "Trigger popup creation on pointer focus" 2023-08-28 12:58:07 +00:00
jenkins-bot 89b7d1fcc2 Merge "Append tooltip to focused pointer to allow tabbing into it" 2023-08-28 12:50:16 +00:00
jenkins-bot b0efa18399 Merge "Generalize revision click handlers" 2023-08-28 12:50:14 +00:00
WMDE-Fisch cc37621ab9 Generalize revision click handlers
The pointer click and revision click handlers did almost the same
and the former was able to handle events from the latter. I merged
them and could then shortcut some code.

Change-Id: Id224b8d8da653110134cce0385da3a18cd073ecf
2023-08-28 11:47:21 +02:00
jenkins-bot b77b5dcbf8 Merge "Dramatically simplify duplicate code in the PointerLine class" 2023-08-28 06:45:23 +00:00
jenkins-bot 2e173563f8 Merge "Don't add keypress handler when not needed" 2023-08-28 06:21:01 +00:00
jenkins-bot 7857eb993d Merge "Reduce code duplication in RevisionList class" 2023-08-28 06:11:22 +00:00
thiemowmde fe8f8fa05d Don't add keypress handler when not needed
I'm not sure why it was done this way. Probably because it doesn't
make an actual difference from the user's perspective. My motivation
is: When we already called the code that auto-expands the
RevisionSlider UI then it doesn't make much sense to give the user
a keyypress handler that does the same a second time.

Possibly even related to T342556?

This patch also contains a few small, unrelated code cleanups.

Change-Id: I123e89d9d7dc3b1e33cf43831c679330d9dd1cdd
2023-08-28 06:10:06 +00:00
jenkins-bot a998e73f25 Merge "Remove unused jQuery.fadeTo() calls" 2023-08-28 05:58:48 +00:00
thiemowmde 2e8cfcba05 Dramatically simplify duplicate code in the PointerLine class
Turns out this code can only ever access a single underline: The one
it owns and can access via it's own this.$html property. One of the
two jQuery selectors always turned out empty, and calling .css() or
anything else on an empty jQuery collection just doesn't do anything.

This patch also contains a similar, but technically unrelated
cleanup in the init code.

Change-Id: Ic89b11971f51f5dcca67dcbd308f65310f48f0ec
2023-08-25 17:49:59 +02:00
thiemowmde e4c55ae5de Reduce code duplication in RevisionList class
Two almost identical pieces of code, both adding revisions to the
list.

There is a 3rd one that prepends revisions. I leave this untouched
for now.

Change-Id: I4798c8c2d6e0f9b70f7ea0dc20bb271514c03350
2023-08-25 17:48:51 +02:00
jenkins-bot a925f7957f Merge "Remove obsolete IE9 safe guard" 2023-08-25 14:52:25 +00:00
WMDE-Fisch cd90d01977 Append tooltip to focused pointer to allow tabbing into it
When the user uses the keyboard to interact with the slider, the
revisions can changed by moving the pointers with the arrorw keys.

In that case the pointers have keyboard focus. To allow tabbing
into the popup from that position, the tooltip needs to follow the
pointer in the DOM. That's what's done in this patch.

Bug: T341872
Change-Id: I75ef7c32fb105526552eac387ff5a5bda8eefe1b
2023-08-25 14:45:24 +00:00
WMDE-Fisch 690156b47c Trigger popup creation on pointer focus
Bug: T341872
Bug: T341874
Change-Id: Ia881bcccfe879f48275e896a186b257d270d88b0
2023-08-25 16:43:22 +02:00
thiemowmde 53281f2b7e Remove unused jQuery.fadeTo() calls
This is a little weird. It looks like this was never actually
animated. The time was always 0.

Change-Id: Ibd476bc3bfb05840959db9e51c411d3b12cebd90
2023-08-25 16:20:55 +02:00
thiemowmde 9f2f774cc4 Remove obsolete IE9 safe guard
Change-Id: I350cc395cb0ab673699cda03f6da19c9470ee7bb
2023-08-25 16:19:14 +02:00
jenkins-bot 72ef3975c7 Merge "Drop wikitext comment in favor of parsedcomment" 2023-08-25 13:54:56 +00:00
jenkins-bot 8ce1f474eb Merge "Don't re-create tooltip when it's already there" 2023-08-25 13:53:50 +00:00
WMDE-Fisch 8c4b9b963a Don't re-create tooltip when it's already there
It took me a while to come up with a solution for this, but there
are several things that seem to trigger the showTooltip method a
bit to often.

Tooltips can be triggered either by the handlers that deal with
mouseenter and mouseleave events that also trigger revision high-
lighling. But tooltips can also be triggered when you use the
keyboard or the mouse while dragging sliders.

The mechanics on what's highlighted and what's triggering a popup
are a bit weiridly setup and there could probably be a major re-
factoring done to make things clear ( for example the show popup
method also highlights the revision but the highlight revision
mehtod does not ). I had a quick approach to fix that, but it's
not too easy.

Another issue is, that some events fire off a delayed popup close
mechanism. So the solution here reads like:

If you are triggered to show a popup, and that popup exists
already, stop the delayed popup close mechanism and bail out.

Bug: T341872
Change-Id: I2646a69cccd549af902d57fdf4ff6fb0e94cbe64
2023-08-25 15:35:06 +02:00
thiemowmde 3d93003dcc Drop wikitext comment in favor of parsedcomment
The plain wikitext comment is apparently not used for anything,
anywhere. It was for some reason used for an "is empty" check. But
we can do the same with the `parsedcomment`. I checked and an empty
comment doesn't result in something non-empty like `<div></div>`, but
stays as an empty string.

Change-Id: Iedc5898b7b0f82231328ab3e0e46b1461ca845b1
2023-08-25 14:42:32 +02:00
thiemowmde 5863e5e73b Make use of jQuery.append() accepting multiple arguments
Change-Id: Ibfd285aeef411f16ba6486fa60114439227b7e6e
2023-08-25 14:39:39 +02:00
thiemowmde 040f6c28ae Fix left/right cursor key handler also acting on all other keys
This code was designed for the left/right cursor keys. But it
currently triggers on all keys. This causes confusing behavior when
tabbing through the UI. This code also triggers on tab/shift+tab,
which can be visibly seen when the wrong popup opens. It also
triggers on enter, which feels like it's intentional, but is nore a
happy accident.

Especially note how the buildTabbingRulesOnKeyUp handler directly
below does the exact same: It only acts on left/right, but no other
key.

We intentionally keep the existing (even if bogus) behavior for the
enter key. To be replaced with something better in a later patch.

Bug: T341874
Change-Id: I75aac4ea3a66a69a44756159c8a98acdc6e74b01
2023-08-25 11:36:22 +02:00
thiemowmde 6b4894c4fb Replace numeric key codes with OO.ui.Keys constants
Bug: T341874
Change-Id: I5393ecfea28938b6d9f79efd80e00ee7d76dfbf0
2023-08-25 10:41:44 +02:00
jenkins-bot f204bfe708 Merge "Replace switch with a map in util class" 2023-08-25 07:20:46 +00:00
jenkins-bot 03235ac917 Merge "Remove unused hasNoTags helper method" 2023-08-25 07:20:45 +00:00
thiemowmde dd9e9e25b4 Remove some self = this indirections that are not needed
Change-Id: I2c267e036a1b8ad395019b1aa3dcb29c21b9b251
2023-08-24 11:36:15 +00:00
thiemowmde a045c78b3d Remove unused hasNoTags helper method
Change-Id: I31b08328d8582bd75c6e972cfbfac7b555455015
2023-08-24 11:29:18 +02:00
thiemowmde 8eff7a7455 Replace switch with a map in util class
Change-Id: If569e34f032ecda261f7970d5ef1e59efc55d56c
2023-08-24 10:59:26 +02:00
Adam Wight b900446572 Migrate JS to ES6
Reintroduces IIFE closures in test files because variables were
declared in the global namespace, and "const" now causes hard errors.

Bug: T339323
Change-Id: I69e9d7a29591137f185f3e5ab02dea590ec4dff6
2023-06-23 08:01:31 +02:00
jenkins-bot 9219f80a65 Merge "Dramatically simplify a forEach loop" 2023-06-15 15:57:47 +00:00
thiemowmde fdc1b1212a Dramatically simplify a forEach loop
I'm not sure why it was done like this. It looks like we can skip
both the extra conditional as well as the extra function scope.

Change-Id: I9aebd17bece0b9a573fc1f9697e79b759741751e
2023-06-15 12:16:59 +02:00
thiemowmde 3ca3013522 Add overflow-x: clip to minimize impact of resize issues
This is certainly not an actual fix for anything. But it makes any
resize issue look much less broken and much more bearable. I think it
is helpful to have this extra safety in place even after we properly
fixed the issue.

Bug: T336729
Change-Id: I724ede9cda120f18c4b7ee3ebf7bb41c0541819e
2023-06-15 12:15:56 +02:00
WMDE-Fisch 7b385ee3ef Skip user setting for unnamed users
Bug: T326908
Change-Id: I6421ad020db98d258c45d1f50d211d38b5c6f3a9
2023-05-24 06:13:56 +00:00
Fomafix 6c0d10ddbe Use .empty().append( $jQueryObject ) instead of .html( $jQueryObject )
According to https://api.jquery.com/html/ a jQuery object is not
supported in .html() although is works.

The .empty() is needed to avoid multiple sliders on resize.

Change-Id: I0ce4748e95529dbe27f82d6fd0aa2433bfda4375
2023-04-22 19:16:31 +00:00
Fomafix 65d1dfefbf Use document.body instead of 'body' as jQuery selector
Change-Id: I2e74d31b61f5f46d1bbb1a0283a7468af9c4e856
2023-04-21 08:52:25 +00:00
Fomafix c86df62861 Use mw.msg( ... ) instead of mw.message( ... ).text()
Change-Id: If954018fdfa5a3609bf48e92de9013b05c485f93
2023-04-21 06:36:08 +00:00
Umherirrender e00aa9f599 stylelint: Enable selector-pseudo-element-colon-notation
Via stylelint --fix

Change-Id: Ic1625ae755233e172cc6db734dc21ed2c5b377d8
2023-03-30 00:42:20 +02:00
libraryupgrader 88f6eccd11 build: Updating npm dependencies
* eslint-config-wikimedia: 0.22.1 → 0.24.0
* grunt: 1.5.3 → 1.6.1
* stylelint-config-wikimedia: 0.13.0 → 0.14.0
  The following rules are failing and were disabled:
  * selector-pseudo-element-colon-notation

Change-Id: Ic78a5aa7fca2d917054eb26b5c8d46c008870484
2023-03-22 21:18:23 +00:00
Umherirrender e62fbf5581 build: Remove unneeded inline stylelint-disable-next-line
The error is suppressed in the .stylelintrc.json file and
does not need inline suppression

Change-Id: I476534fdcd521a2884a6be3b7c8ac5c9d1826ef1
2023-03-21 22:53:26 +01:00
thiemowmde f7a171e14d Fix and add missing JSDoc type hints in SliderView class
Mostly motivated by the missing @type tag.

Also make the syntax more compact. This is significantly easier to
read, I would like to argue.

Change-Id: If5cea5ff66ed345df16a2b417f0db4c56db347c9
2022-11-22 14:32:33 +01:00
Thiemo Kreuz 3faf7ff34c Fix broken initial state when old/new revision id are swapped
This might not be the best possible solution, but it improves the
current, obviously broken situation a lot. At the moment one of the
dots is drawn outside of the slider, even if the revision it should
point at is part of the slider. Turns out the revisions shown on the
slider are loaded in multiple steps. The first step misses one of the
revisions when their order is swapped. When the missing revision is
added later it's already to late.

Bug: T168609
Change-Id: I10d15d04d981c87d35b2431080182fb5e3eb2b2b
2022-09-09 11:18:10 +02:00
Ed Sanders 4ed783c2e7 Remove unnecessary vendor prefixes
Change-Id: I1777f850595b3163e47e353aa02194ba838aebeb
2022-07-19 17:23:08 +01:00
jenkins-bot 643f4d7a27 Merge "Modernize and simplify smaller pieces of code in API module" 2022-06-22 19:36:03 +00:00
Thiemo Kreuz fd9b17633b Modernize and simplify smaller pieces of code in API module
Change-Id: Ic3f65516a76b0e4f03013587b164a56ad3785185
2022-06-22 13:11:52 +00:00
jenkins-bot bc9a5d7d84 Merge "Replace html paragraph tags in i18n" 2022-03-28 13:27:39 +00:00
Mortal303 9dc6fa7fb2 Replace html paragraph tags in i18n
Removed the HTML in the tutorial message and used linebreaks(\n\n) in i18n/en.json file,
replaced .html( mw.message( '…' ).…() ) with .text( mw.msg( '…' ) ) in modules/ext.RevisionSlider.HelpDialog.js
and added 'white-space: pre-wrap' in class '.mw-revslider-column-text' in file modules/ext.RevisionSlider.less
without affecting the front end of the page.

Bug: T267128
Change-Id: Iaf8b1819ca3139c18fb65cfca1c0b2120abb10f4
2022-03-21 15:49:07 +05:30
Ed Sanders 4a44f8c2e5 build: Update devDependencies
Change-Id: I0bbd117b2b3ebdfee8deb7ed38b409a561f570d5
2022-03-17 22:55:02 +00:00
WMDE-Fisch 1fa153aeab Fix issues to prepare for lint update
The new mw eslint config comes with node 12 and the change will be
quite big due to the lock file. I wanted to keep the diff of actual
code changes seperate.

- Applied all code style recommendations
- Removed one test that's not giving any value
- Changed regex .match to .test for performance and convinience

Change-Id: I578be8c6460c7a4d1220354c028a9bfd9bb86d13
2022-01-13 13:59:53 +01:00
Thiemo Kreuz 9aca3a2593 Merge ….RevisionList ResourceLoader module away
It's never used in another context but together with the
….Slider module.

Motivated by the confusion about the two types of require()
introduced in Idf1cc79.

Bug: T233279
Change-Id: I922d7ab56fd3ce80bc901f1a5d7174df6fe6756d
2021-12-20 12:13:09 +01:00