oddbird / slide-deck

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

Add support for links in slide navigation #31

Open jamesnw opened 9 months ago

jamesnw commented 9 months ago

Is your feature request related to a problem? Please describe. Currently, to-slide attributes and the to-slide-named attributes proposed in #30 only work for button elements. This could be expanded to work for links as well.

Describe the solution you'd like As proposed in #29, a user would add the element <a href="#" to-slide="14">To 14</a>. The Web component would then replace the href with the hash link to the slide.

It won't work until the web component is inited, but that's fine because the target id doesn't exist until it's inited anyways.

Describe alternatives you've considered We could require the user to generate the URL in advance. However, the hash pattern is lengthy, and includes the id namespace, and is not easily guessable. We could add a method for generating the URL from outside the component, but then we are requiring the user to manipulate the DOM after the web component has been inited.