oddbird / slide-deck

Web presentations, as a self-contained web component
MIT License
25 stars 0 forks source link

Add slide name-based navigation #30

Open jamesnw opened 9 months ago

jamesnw commented 9 months ago

Is your feature request related to a problem? Please describe. When adding links between slides, it could be difficult to keep index-based links up to date, for instance if a new title slide is inserted at the beginning.

Describe the solution you'd like Each slide could have an optional slide-name attribute, for instance slide-name="shortcuts". Then, the user could add a <button type="button" to-slide-named="shortcuts">To Shortcuts</button> element, which would behave similarly to to-slide="#" where # is the index for [slide-name="shortcuts"].

Ideally, we would also be able to use the name for URL-based hash navigation, but I'm not thinking of a good way to allow for the element to have the index id AND the named id simultaneously.

mirisuzanne commented 9 months ago

I think we could even use to-slide for both?

The only potential overlap would be if you wanted to give a slide a number name? But that seems like a good thing to discourage.

Ideally, we would also be able to use the name for URL-based hash navigation, but I'm not thinking of a good way to allow for the element to have the index id AND the named id simultaneously.

We can't use two IDs. But we could use a non-ID method for numbering slides and moving numerically? Then the ID could be name-based when a name is available? Names could even be provided directly as IDs, potentially. It adds a bit of abstraction to the code. goTo(15) has to look up the 15th slide, find out what ID/name is applied to it. But currently we would have to do the inverse of that (taking the name and looking up a number), so it's not a big loss.