fix(rtl): respect dir of ancestor elements throughout components - #31459
OS-jacobbell wants to merge 6 commits into
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
dir setting of ancestor elements throughout components
dir setting of ancestor elements throughout componentsdir of ancestor elements throughout components
ShaneK
left a comment
There was a problem hiding this comment.
Nice sweep of this! Just a few comments inline, though I'd want the test coverage added before it goes in.
| expect(isRTL()).toBe(false); | ||
| expect(isRTL(null)).toBe(false); | ||
| expect(isRTL(document.createElement('div'))).toBe(false); | ||
| expect(isRTL(render('<div><div id="target"></div></div>'))).toBe(false); |
There was a problem hiding this comment.
The two tests going away here are right, they only covered the optional-param path that no longer typechecks. But nine components changed how they resolve direction in this PR and nothing covers any of them, which FW-7698 does ask for.
The existing suite won't catch a regression either, since the e2e harness sets RTL with document.documentElement.setAttribute('dir', 'rtl'). That's an ancestor, so the RTL screenshots would pass identically on main. The datetime "RTL set on component" test is a decent template.
Co-authored-by: Shane <shane.king@outsystems.com>
There was a problem hiding this comment.
Generated this one with Claude. I don't get why the parameters to ion-col are needed, but it doesn't work without them.
There was a problem hiding this comment.
Generated; it seems too dependent on implementation details.
There was a problem hiding this comment.
Also generated. I feel like this should be a screenshot test, but not sure how that would fit into the test suite.
Issue number: internal
What is the current behavior?
Some components check
document.dir === 'rtl'to determine whether to be left-to-right or right-to-left.What is the new behavior?
isRTL(this.el). This way, any element in the parent chain can define RTL, not just the root document element.isRTL.Does this introduce a breaking change?