Open thubalek opened 6 months ago
Describe the bug <Textfield/> does not handle input$readOnly attribute correctly. Tested with SMUI version 7.0.0
<Textfield/>
input$readOnly
7.0.0
To Reproduce Steps to reproduce the behavior:
<TextField ... input$readOnly="{true}"/>
<TextField ... input$readOnly="{false}"/>
Idea for this code comes from https://github.com/hperrin/svelte-material-ui/issues/280#issuecomment-917448818
Expected behavior In first case there should be HTML code in style <input ... readonly/>
<input ... readonly/>
In second case there should be attribute readonly omitted but it is rendered as
readonly
<input type="text" readonly="false"/>
that is wrong as readonly="false" is is interpreted by browser as readonly="true".
readonly="false"
readonly="true"
See https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attribute and https://html.spec.whatwg.org/multipage/input.html#attr-input-readonly for explanation.
Additional comments The problem is that following code does not work.
<script> import Textfield from "@smui/textfield"; let ro : boolean = false; </script> <TextField ... input$readonly="{ro}"/>
Describe the bug
<Textfield/>
does not handleinput$readOnly
attribute correctly. Tested with SMUI version7.0.0
To Reproduce Steps to reproduce the behavior:
<TextField ... input$readOnly="{true}"/>
<TextField ... input$readOnly="{false}"/>
Idea for this code comes from https://github.com/hperrin/svelte-material-ui/issues/280#issuecomment-917448818
Expected behavior In first case there should be HTML code in style
<input ... readonly/>
In second case there should be attribute
readonly
omitted but it is rendered asthat is wrong as
readonly="false"
is is interpreted by browser asreadonly="true"
.See https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#boolean-attribute and https://html.spec.whatwg.org/multipage/input.html#attr-input-readonly for explanation.
Additional comments The problem is that following code does not work.