Certain browsers have the closest method but do not
support not selectors with multiple arguments. This
variant caters for both.
Bug: T325113
Change-Id: Ib5fc912bfe0f831fea4c9882c25b27541d83b66f
Follow up to
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4 where we switched from the
jquery event delegation pattern to native methods. One thing that we
overlooked was that we also need to consider the case where the selector
matches the parent of an element, for example a span nested inside an
eligible link. I've rethought this logic, to first find the closest
eligible element to normalize the element passed to model methods
before running matchesSelector.
Bug: T325007
Change-Id: I4133751dc900a51829173e9c0d965cbb18e6a33e
Adjust the logic of elementMatchesSelector to fallback
to jQuery when the native matches fails.
Follow up to
Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
Bug: T324514
Change-Id: I0e9e894e77e2eb29fee65853aa98b141bc2a11a3
Allow extensions to register new types of previews via
extension attributes.
Changes:
- The check for reference previews doesn't make sense
as $('a[ href*="#" ]' ) will match any elements with a hash
fragment, so the additional check to Title.getFragment
will not provide a different result. This was introduced in
I9ec57e0fbb0d21beaaa7b359c1c2bef64d2c14f5
- Links that point to themselves are marked with mw-selflink
in MediaWiki so this can use the not selector we already have.
- The new API is used internally and only available via extension
Attributes
- An example is provided in SkinJSON
(https://github.com/jdlrobson/mediawiki-skins-skinjson/pull/14)
Bug: T233099
Change-Id: Iefe98c1f0422dbf034e385b1a41a859d030a2cf4
Replacing deprecated mediawiki.ui `@borderRadius` variable with successor
@border-radius-base.
Former got deprecated in MW 1.35 about 2 years ago. Latter is in alignment
with mediawiki.skin.variables.less standardization. It's also in
accordance to Codex design tokens.
Bug: T322478
Change-Id: Idbd315d14525d75dea951d4144bc84bceb700c0a
This is relevant for reference previews, which might contain
clickable links. If such a link is in the very last line, it
might be (partially) covered by the footer, which is
absolutely positioned on top of the content. This <div>
catches mouse events, but shouldn't.
Bug: T277364
Change-Id: I342b8f8e38c7abaee1e0f4fa38e9b56e747b153b
- Added styling to apply a psuedoelement to the blockquote
- Added a storybook story to cover blockquotes
Bug: T213107
Change-Id: I09706137fec00b3bff649180a559f4f663b71d90
- Fix margin for page preview flipped-x.
- Fix margins for generic previews.
- Add error story to storybook.
- Fix minor typo, pageIds in MODELS.
Bug: T281170
Change-Id: I5b96719c1d08518cbd977590171974796fd10986
This was done while working on T277639 where we introduced
multiple "enabled" flags for individual popup types. This
change listener is one of very few places that work with
this flag. This patch is meant to make this code more robust
and easier to change.
A few unrelated but trivial changes are included that make
code shorter and hopefully easier to read.
Also fixes a bug with tooltips overlapping previews.
Bug: T287119
Change-Id: I7fb0a8d4bb9f5e78fe62cfca524cc157ea89a233
Provide containers for page previews examples
In storybook we avoid position absolute but this deviation from
how they behave in reality could lead to subtle differences that impact
the rendering of previews. It also doesn't allow to see the preview
in the context of the link which is an important part of visually
verifying the position of the pokey arrow.
This also allows us to rethink the broken RTL mode. We now scope
LTR rules to a LTR class that is present on the container, and use
the CSSJanus parsed stylesheet for RTL.
Change-Id: I189019824ddd6aa759790fd162ffcd543619a953
The requirement for landscape images is to be at least 320px
wide. The requirement for portrait images is more relaxed,
only 250px high. Images that fall between these two
requirements currently don't show a thumbnail, even if they
could.
This change affects a very specific group of images:
* Square images from 250 x 250 to 319 x 319.
* Landscape images from 251 x 250 to 319 x 250.
* Landscape images from 319 x 250 to 319 x 318.
The most extreme ratio is 319 x 250. This will be cut to
203 x 250. I.e. the absolute extreme are 58px missing left
and right, but never more.
Requested at https://www.mediawiki.org/wiki/Topic:Vwl97pm6as9fuf6k
Additional stories for testing more extreme small images:
* Small Tall - 300x1000px
* Small Short - 300x200px
Update tests accordingly.
Bug: T268999
Change-Id: I811f1c0e7e9b0c30280b36a61cc7831a5b9e58c8
* For .mwe-popups-image-pointer classes (portraits that have a thumbnail
with a pokey at top) Override the negative margin on the
.mwe-popups-discreet element which undesirably pulls mwe-popups-extract
up.
* Add a top padding to previews when the pokey is at top and the preview
is not a disambiguation and is a landscape preview to account for the
margin around the text getting clipped by clip-path.
* Apply display: block to image to stop whitespace from appearing below
the image.
Bug: T281170
Change-Id: I7ca6c922b2f4615103e4162d96fd90d891deb1df
Now the Vector icon stylesheet is aligned with the correct
design specification these should no longer be needed.
Additional changes:
- Fixes icon display in storybook for disambiguation links
Bug: T287058
Depends-On: Ibc136a17662ae839f90babb21e0f7e8f27b7a7d5
Change-Id: I02bfd7973352a03b5be4b6e82575e2209b8e4043
Removes the following add-ons and their configuration from Storybook:
- addon-cssresources
- addon-knobs
- addon-options
This will hopefully ease the upgrade to Storybook 6.
Removes the custom CSS grid used to position previews within the Storybook
instance in favour of a flexbox layout. This simplifies the creation
of previews for Storybook.
This change requires us to to add relative positioning to
`.mwe-popups-container` so that the footer is correctly positioned in the
popup without absolute positioning. This positioning has been moved to
be Storybook specific to avoid an regressions in production.
Bug: T271763
Change-Id: I9a97291cb4bca7d4cc60dad232a60f6f92c0adea
The Popups UI currently depends on the absolute positioning of the
top-level .mwe-popups element to correctly position it's footer.
This dependence on absolute positioning makes it difficult to debug
Popups in isolation (e.g. in Storybook).
Adding relative positioning to the .mwe-popups-container elements
maintains the correct footer positioning and removes the need for a
specialized layout in Storybook that accommodates absolute positioning.
(If changing the Popups layout to accommodate Storybook seems
unjustified, just think of it as increasing testability).
Bug: T271763
Change-Id: Ifba23afa1a2f401b025476a1fa464c2176fb40ec
Turns out this was only in place because the test was
(intentionally) incomplete. But it's dead code in
production. Let's get rid of it.
Change-Id: Ieeb145b6972dceb7eeda3a167d907b680d5c3ce4
For example: We know the HTML element we are dealing with is
always an <a> element.
I believe the small changes in this patch are all obvious and
non-controversial. Please let me know if you disagree.
Change-Id: I9fe15845affffdd0f5f0fd6ef7d6b607cb567ac7
This is not really an error. It does not really have
consequences for the user, except:
* It might waste bandwidth because the module is loaded, but
unused.
* It might waste a tiny bit of CPU time.
However, this can only happen for registered users, and only
with very specific combinations of settings (notably: a
conflicting gadget must be activated).
The reason it's marked as an error is that previously we could
give more guarantees about this. This changed recently. We will
check if the log message is still helpful and either remove it,
or restore the previous guarantees.
Bug: T271206
Change-Id: I218726c9c4879a405acef68710e79c6ac8d070fe
This minifies the CSS a bit by simplifying some selectors that
don't need to be that specific.
This also optimizes the code for the 3 icons that can appear
in a reference popup:
* The type icon in the title.
* The settings icon in the footer.
* The (i) icon that can appear in the content.
Some of this CSS used "resets on top of resets". This is more
straightforward now.
To fully test all 3 icons please use an example like this:
<ref>
{| class="wikitable mw-collapsible"
| Collapsible table
|}
</ref>
Bug: T234205
Bug: T280762
Change-Id: I9e338475a161164e7707b9bb0498dba640313174
Open questions:
* It is possible to make the patch smaller in case this makes
it easier to backport it. Is this worth it?
* This code is not covered by any test. I think it's worth
writing tests. Most of this code will stay, even after beta.
Bug: T281352
Change-Id: I5f30054f1664643b427909f7fa189b4ea5e11879
Use mw.track instead of dedicated tracker for VirtualPageViews.
This way we can migrate it to the new Event Platform client.
The new client does not observe DNT, which was the reason this
instrument was moved to a dedicated tracker on the first place.
Bug: T279382
Change-Id: I8bb515eab337ffed686ba7522bc6153cfdd8ca8d
The london thumbnail was also replaced with a larger size to fix the RTL landscape story in storybook
Bug: T276668
Change-Id: I00dfe4762c36f49c93144d1207013c41cf33007a
This does not fully solve the ticket, as these are not the
actual OOUI styles. But it's already much better than the
unstyled checkboxes before.
Bug: T281227
Change-Id: I9a5023482774c09aa73845ca6dfd1c4926f088e1
This is the smallest possible patch for a backport.
While it seems there is zero technical reason to limit user
option keys to lowercase with dashes, it's best-practice.
Same as message keys.
Bug: T281235
Change-Id: Ia4a45cf4459543c81b23b757ae9c2cfaf9676894
We changed the handling of the popup settings. They now contain popup types (pages and references).
To not get confused with the old setting options (simple, advanced and off),
we would like to rename the local for the simple setting to page.
It should already contain the correct string.
Bug: T277639
Change-Id: I8847b890e9e31602277a92d82a188fcdd3eea855
* Change more places to not hard-code the popup types, but use
loops and such.
* Change many `function ()` headers to use the more streamlined
ES6 sytnax.
Bug: T277639
Bug: T277640
Change-Id: Ifece87d51012e0e069286453b27f5c9ae273710e