-
Notifications
You must be signed in to change notification settings - Fork 6.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(material-experimental/mdc-form-field): notched-outline sho… (#18381)
* fix(material-experimental/mdc-form-field): notched-outline should include prefixes and suffixes When we landed the initial MDC form-field implementation, we intentionally left the outline appearance with prefixes and suffixes in a visually bad state. We did this because it was unclear how to proceed due to a limitation with the MDC notched-outline. After chatting more with the MDC team about this, and experimenting with more alternatives, the form-field will now follow MDC as close as possible. Instead of requiring changes upstream to MDC which aren't necessarily reasonable (due to us supporting arbitrary prefix/suffix content), we just use the notched-outline as intended. To summarize what happened before: Our form-field supports abitrary prefixes and suffixes. This is different in MDC, which always assumes a fixed width/size for prefixes and suffixes. Ultimately, this causes problems for us since in the outline appearance, the label should be relative to the infix container (not overlap prefixes), but still be aligned vertically over the prefix container. MDC achieves this by simply shifting the label by a fixed amount of pixels (since they only allow a specific width for prefixes and suffixes). This won't work for us since our prefix container can scale as much as possible. To reasonably fix this issue in a way that leverages/follows MDC as much as possible, we determine the prefix container width programmatically and shift the floating label horizontally based on the measured width. This is basically the same approach MDC takes.. just that we have a dynamic label offset measured at runtime. For more context on the issue, refer to the original feature request in MDC: material-components-web#5326. * fixup! fix(material-experimental/mdc-form-field): notched-outline should include prefixes and suffixes Address feedback; and handle SSR better
- Loading branch information
1 parent
782f114
commit fc91061
Showing
9 changed files
with
233 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.