[TextField] Outline has Inline Styles
See original GitHub issueUsing the TextField component with the variant prop set to “outlined” will inline a padding-left and width inline style. This is difficult to accommodate for Content Security Policy.
- This is not a v0.x issue.
- I have searched the issues of this repository and believe that this is not a duplicate.
Expected Behavior
All styles provided by material-ui should be inlined in the head tag which contains a CSP nonce
Current Behavior
When implementing TextField, the following HTML is output - note the style attributes
<fieldset aria-hidden="true" class="MuiNotchedOutline-root-174 MuiOutlinedInput-notchedOutline-151" style="padding-left: 8px;">
<legend class="MuiNotchedOutline-legend-175" style="width: 38px;"></legend>
</fieldset>
Steps to Reproduce
Link: https://codesandbox.io/s/31prwv9j5q
- Implement TextField component
- add variant=“outlined”
- Inspect the fieldset and input elements
Context
This makes implementing a good CSP difficult due to arbitrary inline styles
Your Environment
Tech | Version |
---|---|
Material-UI | v3.2.2 |
React | v16.5.2 |
Browser | Chrome 69 |
Issue Analytics
- State:
- Created 5 years ago
- Reactions:2
- Comments:12 (8 by maintainers)
Top Results From Across the Web
[TextField] Outline has Inline Styles #13364 - mui/material-ui
Using the TextField component with the variant prop set to "outlined" will inline a padding-left and width inline style. This is difficult ...
Read more >border-inline-style - CSS - MDN Web Docs
The border-inline-style CSS property defines the style of the logical inline borders of an element, which maps to a physical border style ...
Read more >Material UI inline styling - specific component colours
I'm trying to style my TextFields from Material-UI. I have a black background and I need both the textField border and text to...
Read more >Change text field border color in inline style | Support Center
I need to change the color of the input field depending on the condition. For example: <pega: when name = "testWhen"> border: solid...
Read more >How to Remove and Style the Border Around Text Input Boxes ...
To have clear fields in your forms, set the outline property to its "none" value, which is used to display no outline. input...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m closing as I don’t think that we should stop ourselves to use inline style if it can enable better solutions.
Regrading the very case of the text field, #17680 will very likely remove this inline style.
See #19938 for the general issue with inline-style for CSP.
I’m not sure we should fix this issue. We are using inline style at different locations in the code base. cc @mui-org/core-contributors.