carbon-design-system / carbon

A design system built by IBM
https://www.carbondesignsystem.com
Apache License 2.0
7.86k stars 1.82k forks source link

[List] Dropdown control has a hard-coded "Open menu" and "Close menu" tooltip and not compatible with globalization #8091

Closed cheer021 closed 3 years ago

cheer021 commented 3 years ago
## What package(s) are you using?

Detailed description

Describe in detail the issue you're having.

[List] List control has a hard-coded "Open menu" and "Close menu" tooltip and not compatible with globalization

Is this issue related to a specific component?

Dropdown control https://www.carbondesignsystem.com/components/dropdown/usage

What did you expect to happen? What happened instead? What would you like to see changed?

Either

What browser are you working in?

Chrome - this is a cross-browser issue

What version of the Carbon Design System are you using?

What offering/product do you work on? Any pressing ship or release dates we should be aware of?

IBM Cognos Analytics: This issue is not gating our release

Steps to reproduce the issue

  1. Open the List control link
  2. Hover over the arrow svg
  3. See "Open menu"

Additional information

Screen Shot 2021-03-15 at 12 24 05 PM

tw15egan commented 3 years ago

The ListBox components should all accept a translateWithId prop that can be used to implement globalization. Here is a quick example:

const listBoxMenuIconTranslationIds = {
  'close.menu': 'Translated Close text ',
  'open.menu': 'Translated Open text ',
  'clear.all': 'Clear all',
  'clear.selection': 'Clear selection',
};

<Dropdown
   ...
   translateWithId={(id) => listBoxMenuIconTranslationIds[id]}
/>

Screen Shot 2021-03-15 at 11 36 01 AM

Screen Shot 2021-03-15 at 11 40 37 AM