From 525de50cf1226e672b6bfd0ddc9c66b7971b059e Mon Sep 17 00:00:00 2001 From: Philipp Gfeller Date: Thu, 10 Oct 2024 21:36:42 +0200 Subject: [PATCH] Answer question of directionality Issue #1098 resolved to make the switch adapt to flow direction of scripts and render the "on" state on the left side for `rtl` and on the right side for `ltr`. --- site/src/pages/components/switch.explainer.mdx | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/site/src/pages/components/switch.explainer.mdx b/site/src/pages/components/switch.explainer.mdx index 2caf0994..55a12fe5 100644 --- a/site/src/pages/components/switch.explainer.mdx +++ b/site/src/pages/components/switch.explainer.mdx @@ -525,9 +525,16 @@ The switch element can be associated with the existing `role="switch"`. ### Globalization
- Is thumb in the "on" position on the left in a `rtl` directional environment? + How should the switch behave in writing modes other than `horizontal-tb`?
+The switch should adapt to the current text direction[^11]. + +| Writing mode | Direction | "on" position | +| ------------- | ------------- | ------------- | +| horizontal-tb | Right to left | left side | +| horizontal-tb | Left to right | right side | + ### Security {/* _Are there any security implications surrounding the component?_ */} @@ -564,3 +571,4 @@ References: [^8]: Elements approach resolution https://github.com/openui/open-ui/issues/702#issuecomment-1664464531 [^9]: Thumb content resolution https://github.com/openui/open-ui/issues/979 [^10]: Track content resolution https://github.com/openui/open-ui/issues/978 +[^11]: Direction change resolution https://github.com/openui/open-ui/issues/1098