Skip to content
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

<Textfield/> does not handle input$readOnly attribute correctly. #657

Open
thubalek opened this issue May 17, 2024 · 0 comments
Open

<Textfield/> does not handle input$readOnly attribute correctly. #657

thubalek opened this issue May 17, 2024 · 0 comments
Labels
bug Something isn't working

Comments

@thubalek
Copy link

Describe the bug
<Textfield/> does not handle input$readOnly attribute correctly. Tested with SMUI version 7.0.0

To Reproduce
Steps to reproduce the behavior:

  1. Use <TextField ... input$readOnly="{true}"/>
  2. Use <TextField ... input$readOnly="{false}"/>

Idea for this code comes from #280 (comment)

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 as

<input type="text" readonly="false"/>

that is wrong as readonly="false" is is interpreted by browser as 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}"/>
@thubalek thubalek added the bug Something isn't working label May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant