angular / angular/components

bug MatFormFields: Force LTR in RTL page

Open
#26,778 1 comment 0 reactions 0 assignees View on GitHub
area: material/form-field P3
Dominant language
TypeScript
Stars
25k
Forks
6.8k
Avg merge
1d 8h
Merged PRs (30d)
91

Description

### Is this a regression?

- [ ] Yes, this behavior used to work in the previous version

### The previous version in which this bug was not present was

_No response_

### Description

The current style behavior for form fields that if there is any RTL direction previous to it, it will be targeted.
since the LTR is the default case it wont be an issue to force the component to be RTL, however in RTL page you cant force LTR direction to MatFormFields.

### Reproduction

Steps to reproduce:
1. set dir rtl globally in index.html
2. set dir ltr to any form filed
https://stackblitz.com/edit/components-issue-2e8dha?file=src/app/example-component.html

### Expected Behavior

to be able to change direction of formfield

### Actual Behavior

formfield style stays rtl with direction ltr on in

### Environment

- Angular: 15
- CDK/Material: 15
- Browser(s): Chrome
- Operating System (e.g. Windows, macOS, Ubuntu): Ubuntu

Contributor guide

Open the contributing guide

Research direction

Start with the linked StackBlitz reproduction, checking the global direction in index.html and the form field markup in src/app/example-component.html. Trace how the form field responds to global RTL and local LTR settings. Done means a form field with dir="ltr" renders LTR even when the page direction is RTL.

Written by the indexing model from the issue text.

Assessment

Tech stack
angular
Domain
frontend, internationalization
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.