firefox-devtools / ux

Firefox DevTools UX Community
Mozilla Public License 2.0
103 stars 21 forks source link

Rules autocomplete: Show suggested/autofilled values #73

Open violasong opened 4 years ago

violasong commented 4 years ago

Add a section to the Rules autocomplete popup that shows the format of CSS shorthand values (or for any property that has multiple value parts).

This could start as an informative feature, but it could get more interactive - e.g. inlining the autocomplete so that after you type border: it puts in 1px solid black with 1px highlighted, ready to be edited. Press space or tab to go to solid.

MDN has structured data on all css values which we could use this to guide the autocomplete.

Extra info from @oslego:

A smart default that can be atomically edited will also help with prefilling basic CSS Shapes, for example polygon() -> polygon(0 0, 0 100% 100% 100%, 100% 0) (bug filed).

To achieve this, we need to make changes to InlineEditor.js so it supports the concept of “parts” for a value and then hook up a dictionary mapping value parts for properties. (We’ll also have to reconcile events for when a user may want to fully replace the value, not individual parts) Not trivial, but definitely worthwhile investing the effort. To my knowledge, no other DevTools have this feature (navigate by value parts), but it is an indispensable feature in great code editors. The Emmet extension for code editors popularized this for CSS (AFAIK)