w3c / window-management

Window Management API
https://www.w3.org/TR/window-management/
Other
95 stars 25 forks source link

Internal bidi considerations for the `label` #127

Open aphillips opened 1 year ago

aphillips commented 1 year ago

2.1 Screen https://www.w3.org/TR/window-placement/#screen-label

A screen has a label, which is a string that meaningfully describes the screen to a user to help them identify and differentiate screens.

Note: The label can be an arbitrary string selected by the user agent. It could describe the screen relative to the device, e.g. "internal" vs. "external", it could include the dimensions, e.g. "640×480", it could include hardware model information, e.g. "Acme Telletube 1000x" from VESA E-EDID data, it could include a distinguishing number, e.g. "screen 1" vs. "screen 2", or all of the preceding. The label can be an empty string if underlying display details are unknown or the user agent chooses to hide that information. Applications can’t assume that the label contains any specific information, such as the device type, model, dimensions, density, etc.

The discussion of the content of the label do not mention the potential for other languages. I18N would expect that this API, when queried on systems running with various locales, would return labels either in the operating system/user-agent's locale or in the locale of the page/query context.

One effect of this for labels that are in a right-to-left language, such as Arabic, Hebrew, and some others, is that the name may not display correctly, particularly if it is generated by the system from tokens or values. Spillover effects can happen when text that has mixed left-to-right and right-to-left text are used in a larger sentence. This is particularly true for device labels because they often feature tokens such as brand names ("Dell", "HP", etc.), part numbers ("S2721H", "A157-B", etc.), device capabilities ("75 Hz", "4ms", etc.), or resolution (1024x768) that use ASCII letters, digits, and punctuation. This often leads to mixed direction names such as:

Brand A123B (1920 x 1080) 36" monitor 75 Hz, 4ms, built-in speakers

Or in Arabic:

ماركة A123B (1920 x 1080) 36" شاشة الكمبيوتر, 75 Hz, 4 مللي ثانية, مكبرات صوت مدمجة

image

(Notice how 36 and " are separated, the resolution is potentially backwards, 75 Hz and 4ms both separate the number from the measurement--there are other mix-ups in the Arabic that will only be visible to Arabic speakers).

We would suggest adding a mention of the need to emit a "bidirectionally clean" string (using bidi control characters and the like). For example, you could add a sentence just before this one in the Note:

The label can be an empty string if underlying display details are unknown or the user agent chooses to hide that information.

saying something like:

If the label contains or might contain [= bidirectional text =], care should be used to ensure that the string will display correctly without the application needing to process the string. For more information see here

Note that the [= =] would be a link to the i18n-glossary, specifically here