-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add RTL support #2890
Add RTL support #2890
Conversation
@compulim thanks, got it fixed :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks great. Very high quality. You must spent quite a lot of time proof-reading your own code.
const directLine = useMemo(() => createDirectLine({ token }), []); | ||
const store = useMemo( | ||
() => | ||
createStore({}, () => next => action => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe improve this one using a button bar + onhashchange
later.
samples/02.branding-styling-and-customization/g.change-locale/index.html
Show resolved
Hide resolved
const res = await fetch('https://webchat-mockbot.azurewebsites.net/directline/token', { method: 'POST' }); | ||
const { token } = await res.json(); | ||
|
||
window.WebChat.renderWebChat( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could use a button bar + onhashchange
later.
Co-Authored-By: William Wong <[email protected]>
Co-Authored-By: William Wong <[email protected]>
whoo hoo! |
WOW Thanks @corinagum! cant wait to try it |
Fixes #1976
Fixes #2902
Changelog Entry
Description
Implement the ability to display languages (such as Arabic, Urdu, etc) in Right-to-Left UI.
What is Right to Left, Left to Right, and Bidirectional Support?
(*) 'Mirror' in this article is not meant literally. In UI rules of BiDi, not every aspect or component will be mirrored, and the rules dictating those decisions will be discussed below.
Why do we want Web Chat to support this?
ar-AR
he-IL
ar-JO
ar-EG
Pros
Cons
Adaptive Cards and react-filmvideo
andaudio
have RTL support, Web Chat's RTL experience will not be fully functionalHowever, I believe that Web Chat having RTL support will encourage the Adaptive Cards team to also implement the featureWeb Chat dependencies that need RTL Support:
<video>
and<audio>
(not currently supported)Steps for implementing bi-directional support
Order of detection for script direction:
dir: auto
(default)) to:ltr
orrtl
inrenderWebChat
propsImplementation steps as they apply to Web Chat
root container'sBasic Transcript and Basic Sendbox dir attribute depending on what was detected in 'Order of detection for script direction'a. Icons showing direction need to be flipped
b. Icons that show 'right hand use' do not need to be flipped
useDirection
documentation toHOOKS.md
Icons/animations that need to be mirrored
dir
prop and/or automatic direction detection (See dependencies section above)Spinner animation- I believe that spinners, going clockwise, are meant to represent the passage of time, and therefore should NOT be mirrored. Anecdotal and completely non-scientific information would point to a spinner remaining clockwise in RTL UI. No official-looking sources found on this topicSound slider SHOULD be mirrored - Audio / Videosee dependencies aboveMedia CONTROLS SHOULD NOT be mirroredHTML5 does not support rtl for<video>
or<audio>
see dependencies aboveSituations to test
HTML Videos- should be rendered by browser, but sound bar should be flippedAudio- should be rendered by browser, but sound bar should be flippedYouTube & vimeo- test that layout is correctreact-film
Tests added to Mock Bot (still waiting on Arabic strings)
Mock Bot
Offline Mock Bot
[ ]File attachmentKnown internal issues
<div>
which created erroneous scrollbar in RTL modeWeb features we will not use / Non-universal browser support
text-align
: 'start/end' - Not supported in Edge (or Internet Explorer)match-parent
is only supported by Chrome and Firefox<bdo>
Documentation / Guidance / Data
https://hacks.mozilla.org/2015/09/building-rtl-aware-web-apps-and-websites-part-1/
https://hacks.mozilla.org/2015/10/building-rtl-aware-web-apps-websites-part-2/
https://material.io/design/usability/bidirectionality.html#mirroring-layout
https://www.ethnologue.com/guides/ethnologue200
Tests TBD
RTL sample added