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

webkitdirectory on input tag fails #2968

Closed
1 of 3 tasks
SpanishPear opened this issue Nov 16, 2022 · 3 comments · Fixed by #3214
Closed
1 of 3 tasks

webkitdirectory on input tag fails #2968

SpanishPear opened this issue Nov 16, 2022 · 3 comments · Fixed by #3214
Labels

Comments

@SpanishPear
Copy link
Contributor

Problem
I am trying to write an input element with the webkitdirectory attribute.
It fails at

error[E0277]: the trait bound `bool: IntoPropValue<std::option::Option<AttrValue>>` is not satisfied
  --> src/components/menubar.rs:17:30
   |
17 |             webkitdirectory={true}
   |                              ^^^^ the trait `IntoPropValue<std::option::Option<AttrValue>>` is not implemented for `bool`

Steps To Reproduce
Steps to reproduce the behavior:

  1. add an input element with the webkitdirectory attribute

Expected behavior
It to work, and allow me to select directories

Screenshots
If applicable, add screenshots to help explain your problem.

Environment:

  • Yew version: 0.19.3

Questionnaire

  • I'm interested in fixing this myself but don't know where to start
  • I would like to fix and I have a solution
  • I don't have time to fix this right now, but maybe later

Is there a shim I could do in the meantime to unblock myself?

@WorldSEnder
Copy link
Member

WorldSEnder commented Nov 17, 2022

A proposal for a work-around: webkitdirectory={value.then_some("".into())} where value is a bool or webkitdirectory={Some("".into())} if value is true as in the example.

@SpanishPear
Copy link
Contributor Author

Ooh I'll give that a shot!

@SpanishPear
Copy link
Contributor Author

Ended up with
webkitdirectory={Some("")}

.into() confused compiler, as it couldnt decide between impls
😎 🥳

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants