seed icon indicating copy to clipboard operation
seed copied to clipboard

The list of missing common Ev, At or Tag

Open MartinKavik opened this issue 5 years ago • 5 comments

Lists:

  • Ev list: https://github.com/seed-rs/seed/blob/master/src/dom_entity_names/events/event_names.rs
  • At list: https://github.com/seed-rs/seed/blob/master/src/dom_entity_names/attributes/attribute_names.rs
  • Tag list: https://github.com/seed-rs/seed/blob/master/src/dom_entity_names/tags/tag_names.rs
  • St generated list: https://github.com/seed-rs/seed/blob/master/src/dom_entity_names/styles/style_names.rs

Missing:

  1. At::Role
    • https://www.freecodecamp.org/news/html-role-attribute/
    • https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles/button_role
  2. Ev::Invalid
    • https://developer.mozilla.org/en-US/docs/Web/API/HTMLInputElement/invalid_event

Don't hesitate to write missing items in comments below or create a PR!

MartinKavik avatar Jul 20 '20 22:07 MartinKavik

I think data-target attribute is missing. I only found At::Data.

L0g4n avatar Sep 16 '20 11:09 L0g4n

I think data-target is a specific Bootstrap attribute that leverages data-* attributes (please correct me if I'm wrong). Perhaps we can add a helper like At::data("xx", "yy") that generates data-xx="yy" in the future, but I don't think we should add specific data variants.

MartinKavik avatar Sep 16 '20 12:09 MartinKavik

I do not know about that, but other CSS frameworks are also using this attribute, e.g. Bulma: https://bulma.io/documentation/components/navbar/#basic-navbar But now I see that the docs are strange. In the first example they are using data-target for the hamburger menu, then later they just omit that attribute. Edit: I guess then it's not really required? 🤷

L0g4n avatar Sep 16 '20 12:09 L0g4n

I just checked to see if I could help somehow and this issue was tagged as a "good first issue". I looked into https://github.com/seed-rs/seed/blob/f0a1550d52cdbc9bf660e5ab7cee999c04386ab1/src/dom_entity_names/events/event_names.rs#L48 and the Invalid event is already there.

And what about the At::Role ? Should I add all the ARIA roles https://developer.mozilla.org/en-US/docs/Web/Accessibility/ARIA/Roles ?

I also noticed that if I run cargo test on seed, there is a lot of doctests that fail to even compile, even though they are no_run, but cargo tries to at least build them, so they don`t get forgotten when changes happen.

tommket avatar Jan 13 '21 15:01 tommket

hi @tommket!

There is a bit older, but still very relevant issue about the new API design. See this comment in the issue to have an idea: https://github.com/seed-rs/seed/issues/525#issuecomment-684040068. Notice especially attr::xx calls.

The idea is:

  1. The list of all attributes would be downloaded from a public source (MDN or W3C database or something similar; probably including ARIA roles like you suggested).
  2. Typed Rust items would be generated from the downloaded list.
  3. Everyone would be happy. We wouldn't need to write the list manually (the topic of this issue) and there wouldn't be weird functions like as_at_value in attrs!{ At::Disabled => disabled.as_at_value() }.

The same principle apply to typed CSS, events and tags.

However, to move forward, we need to finalize the design first. It's a tough task because everyone has a different opinion and it's pretty hard to design it properly (especially CSS), but it's basically the last big feature that blocks Seed stabilization, so the help would be VERY welcome. Write me on Discord if it's interesting for you, please.


I also noticed that if I run cargo test on seed, there is a lot of doctests that fail to even compile, even though they are no_run

Somewhere in the "backlog" there was a task to improve doc examples once the new Rust documentation behavior is released. It has been already released - see https://stackoverflow.com/questions/31582064/how-to-link-to-other-fns-structs-enums-traits-in-rustdoc/53504254#53504254 - so we can improve it now but it hasn't got the highest priority. However cargo test doesn't play nice with WASM apps at the moment, tests have to be run through wasm-pack + wasm_bindgen. You can run cargo make verify in the project root to start the entire format/lint/test pipeline. Ask on #support or #devel channel if you want to know more about it.

MartinKavik avatar Jan 13 '21 19:01 MartinKavik