Page MenuHomePhabricator

Implement custom LanguageSelector component
Closed, ResolvedPublic13 Estimated Story Points

Assigned To
Authored By
Sarai-WMDE
Feb 3 2023, 12:50 PM
Referenced Files
F36939243: Screenshot 2023-04-04 at 15.31.22.png
Apr 4 2023, 1:31 PM
F36939115: Screenshot 2023-04-04 at 12.49.16.png
Apr 4 2023, 10:49 AM
F36939114: Screenshot 2023-04-04 at 12.48.49.png
Apr 4 2023, 10:49 AM
F36925394: Screenshot 2023-03-24 at 11.27.50.png
Mar 24 2023, 10:39 AM
F36925363: Screenshot 2023-03-24 at 10.12 1.png
Mar 24 2023, 10:39 AM
F36782608: close.svg
Feb 7 2023, 11:34 AM
F36782606: clear.svg
Feb 7 2023, 11:34 AM
F36782588: search.svg
Feb 7 2023, 11:34 AM

Description

User stories

As a user of the Query Builder and/or the Mismatch Finder, I want to be able to easily switch the interface language of these tools.

Background

  • Description: Language selectors display a list of languages that users can choose from. Apps can then treat selections according to different use cases (e.g. navigating to a different version of a page, purely as an input in case of translation, update the interface language). Check the Design Style Guide page on Language selector for further details.
  • Previous implementations: After an investigation (see T324653), we decided to base our custom implementation of the LanguageSelector off of the new Vue component created by the Language team at WMF (available on GitHub).

Design spec

Acceptance criteria

The custom LanguageSelector component is implemented following the design specifications:

  • The component's visual properties match the design guidelines
  • The component presents languages in a single-column list
  • States: the default state of the component is active, it can be filled and present an empty state in the lack of a match
  • The component becomes full-screen on mobile
  • The component adjusts to different reading directions (LTR, RTL)
  • The component is fully usable via keyboard

Notes

Please note: there is no loading state for this component
There seems to be a slowness issue with this, and fixing it is part of the challenge of creating the component. But also good to note that the language switcher of the query GUI faces similar issues
This component will be replaced by Codex. As such, it's a temporary thing and does not need to be fulled polished. Its been added to our tech debt list

Considerations

  • The need to subject the component to a specific type of testing should be documented here.

Attachments

Related Objects

StatusSubtypeAssignedTask
ResolvedArian_Bozorg
Resolvedguergana.tzatchkova
ResolvedHasanAkgun_WMDE
Resolvednoarave
ResolvedItamarWMDE
Resolvedabi_
ResolvedBUG REPORTLucas_Werkmeister_WMDE
Resolvedguergana.tzatchkova
Resolvedguergana.tzatchkova
Resolvedguergana.tzatchkova
ResolvedHasanAkgun_WMDE
ResolvedLucas_Werkmeister_WMDE
Resolvedguergana.tzatchkova
ResolvedLucas_Werkmeister_WMDE
Resolvedguergana.tzatchkova
ResolvedBUG REPORTguergana.tzatchkova
OpenNone
OpenBUG REPORTNone
OpenNone
Resolvednoarave
OpenNone
Resolvednoarave
Resolvedguergana.tzatchkova

Event Timeline

karapayneWMDE set the point value for this task to 13.
karapayneWMDE moved this task from Unified DOT Backlog to Sprint-∞ on the Wikidata Dev Team board.

Task Breakdown Notes:

  • Query Builder first: will create the component in QB and copy it over to Mismatch Finder
  • Accept the tech debt of having two copies of the component until we decide whether to upstream it to Codex / inherit a codex implementation
  • We will not discuss the Query builder subtask (T328148): as it is understood to be part of this ticket that we are discussing
  • Although the specs display a multi-column layout, we are only creating a single column layout for the widget regardless of the number of languages, this should simplify responsivity in this initial version of the widget
  • These specs are more generic than what we are used to, as it does not use any of the design system tokens in this initial stage
  • Languages are displayed in their autonyms
  • Loading state is not specified for this component at this point in time, and is not in the scope of this task
  • Filtering should also remove filtered out items from the list
  • Filtering at the first version should be done by antonym alone
  • RTL mode depends on the current interface language
  • The keyboard shortcuts mentioned are based on the codex typeahead search component, and might need to be reimplemented.
  • At the very least, unit tests for the component should be included, and potentially browser tests as well, as they are already set up in QB
  • This task most probably not parllelizable
  • Break out small sub tasks as we do them from the list below (or at least for any adaptation of that list)

Potential Plan of Action:

  1. Create a new component in the QB componentes directory
  2. Take a look at the Vue Language Component made by the Language team, to try and see which patterns can be reused
  3. Basic Markup is added and rendered from a languages prop (and message of unavailable language) including CSS states
  4. Keyboard navigation is implemented
  5. Filtering behavior is added
  6. RTL state is added
  7. Mobile version (with additional Close button and full screen width) is implemented

Should the current user interface language be part of the shareable link or not?

Should the current user interface language be part of the shareable link or not?

Probably not but let's ask in the big runde just to be sure.

Should the current user interface language be part of the shareable link or not?

Since we don't include it in the Query UI let's not do it here either.

This comment was removed by Michael.

Hello there! Just took a look at the LanguageSelector in Query builder and, first, it looks great! 💯 I just found a couple of fixes:

  1. The clear icon is not vertically aligned within the input:

Screenshot 2023-03-24 at 10.12 1.png (297×409 px, 22 KB)

  1. If possible, the top border of the menu shouldn't be visible. It should overlap with the input's border. At the same time, the input drops a shadow on top of the menu with the value 0 1px 2px rgba( 0 , 0 , 0 , 0.251 ). We should try this, as it would make the component look closer to the Style guide specs and the Language team's implementation. Nevertheless, if this is not an easy change, it's fine if we keep the current look as a compromise but make the menu's top border radius 0px (the design direction here is a bit unclear at the moment but the latter is what Codex does for now).

Screenshot 2023-03-24 at 11.27.50.png (144×666 px, 12 KB)

  1. Currently, the menu changes in height when it's filtered: it wraps around the fewer available options. Following the existing implementations, though, it looks like the menu's height shouldn't change.
Current implementationWith adjustment
Screenshot 2023-04-04 at 12.48.49.png (266×410 px, 19 KB)
Screenshot 2023-04-04 at 15.31.22.png (429×392 px, 24 KB)

The fix looks good both above and below the tablet breakpoint: the menu preserves a fixed height even when it's filtered and the number of items is reduced. Thank you, @guergana.tzatchkova!

Change 907821 had a related patch set uploaded (by Guergana Tzatchkova; author: Guergana Tzatchkova):

[wikidata/query-builder@master] Align clear button with input field

https://gerrit.wikimedia.org/r/907821

@Sarai-WMDE for issue nr 1 could you please check here if the aligment is better:
https://907821--clicky-sparqly.netlify.app/
https://gerrit.wikimedia.org/r/c/wikidata/query-builder/+/907821

This ticket is only for the alignment.

Change 907879 had a related patch set uploaded (by Guergana Tzatchkova; author: Guergana Tzatchkova):

[wikidata/query-builder@master] Make border-radius 0 only for top border

https://gerrit.wikimedia.org/r/907879

For point 2 @Sarai-WMDE and I have decided that the box-shadow will be left as is for now because the CSS is already there but it is not being displayed as expected and we don't want to invest too much in this at this moment.

The border-radius of the top of the menu has been set to 0px in this patch: https://gerrit.wikimedia.org/r/c/wikidata/query-builder/+/907879
Test:
https://907879--clicky-sparqly.netlify.app/

Change 907821 merged by jenkins-bot:

[wikidata/query-builder@master] Vertically align clear button with input field

https://gerrit.wikimedia.org/r/907821

Change 907879 merged by jenkins-bot:

[wikidata/query-builder@master] Make border-radius 0 only for top border

https://gerrit.wikimedia.org/r/907879

Arian_Bozorg claimed this task.
Arian_Bozorg subscribed.

Thanks so much for all your work on this everyone!

This is looking good for now, we will get to some of the bugs and tweaks in the future