-
Notifications
You must be signed in to change notification settings - Fork 6.8k
dir="auto" is changed by Dir directive #13855
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
Comments
This fix can be used as a temporary workaround: import {Directive, HostBinding, Input} from '@angular/core';
/**
* This is fix for this issue in angular material: https://github.com/angular/material2/issues/13855
* TODO: remove it when the issue is fixed
*/
@Directive({
selector: '[dir]'
})
export class MaterialDirFixDirective {
@HostBinding('attr.dir')
@Input()
dir: string;
} |
We probably shouldn't be overriding the attribute's value, but note that |
Yes, I think dir **attribute** should be leaved untouched.
Btw, `Dir` directive selector is not specific to material components. I'm
actually using `dir="auto"` on an input.
|
Currently we normalize any values that aren't `ltr` or `rtl` to `ltr` in order to have a predictable value when using the directionality in components, however this ends up overwriting the consumer's value which might not necessarily be used by Angular (e.g. setting it to `auto`). These changes switch to preserving the attribute while normalizing the value for when it gets injected. Fixes angular#13855.
Currently we normalize any values that aren't `ltr` or `rtl` to `ltr` in order to have a predictable value when using the directionality in components, however this ends up overwriting the consumer's value which might not necessarily be used by Angular (e.g. setting it to `auto`). These changes switch to preserving the attribute while normalizing the value for when it gets injected. Fixes angular#13855.
Currently we normalize any values that aren't `ltr` or `rtl` to `ltr` in order to have a predictable value when using the directionality in components, however this ends up overwriting the consumer's value which might not necessarily be used by Angular (e.g. setting it to `auto`). These changes switch to preserving the attribute while normalizing the value for when it gets injected. Fixes #13855.
Currently we normalize any values that aren't `ltr` or `rtl` to `ltr` in order to have a predictable value when using the directionality in components, however this ends up overwriting the consumer's value which might not necessarily be used by Angular (e.g. setting it to `auto`). These changes switch to preserving the attribute while normalizing the value for when it gets injected. Fixes #13855.
Currently we normalize any values that aren't `ltr` or `rtl` to `ltr` in order to have a predictable value when using the directionality in components, however this ends up overwriting the consumer's value which might not necessarily be used by Angular (e.g. setting it to `auto`). These changes switch to preserving the attribute while normalizing the value for when it gets injected. Fixes #13855.
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
Bug:
Dir directive treats anything other than
rtl
andltr
as invalid value, and changes dir attribute toltr
which breaksdir="auto"
.What is the expected behavior?
It should not change dir attribute. dir="auto" is perfectly fine.
What is the current behavior?
It changes it to
ltr
Which versions of Angular, Material, OS, TypeScript, browsers are affected?
All versions since this pull request is merged.
The text was updated successfully, but these errors were encountered: