CentreForDigitalHumanities / backbone-util

Various utilities for Backbone applications
BSD 3-Clause "New" or "Revised" License
0 stars 0 forks source link

makeLinkEnabler does not allow marking specific links as "normal" links #4

Open tijmenbaarda opened 4 days ago

tijmenbaarda commented 4 days ago

In the the EDPOP vre, we have certain internal links in the UI that are not handled by the SPA but instead by the backend. There are also a number of <a> elements that act like buttons (they have # as their anchor and they include the role="button" property). I don't see a way in makeLinkEnabler to exclude specific links. I would propose the following:

@jgonggrijp : if you agree, I will create a pull request for these changes.

jgonggrijp commented 4 days ago

Regarding links that should be handled by the backend rather than the SPA, I think it will suffice if you include the domain and a scheme in the URL. For example, change <a href="/login"> into <a href="//localhost:8000/login">.

As for an <a role=button href="#">, I agree that it should not be intercepted by the link enabler. But what if the href is something more elaborate? Is there really such a strict semantic that anything with role=button should never lead to route changes?

tijmenbaarda commented 4 days ago

As for an <a role=button href="#">, I agree that it should not be intercepted by the link enabler. But what if the href is something more elaborate? Is there really such a strict semantic that anything with role=button should never lead to route changes?

Now I think of it more carefully: I think you are right. Take GrETEL, where the application state can be very carefully reproduced from the URL. This application also tracks the configuration, which is set using buttons, in the URL. These buttons are clearly not links, but they do change the URL.

Would you rather make an exception for <a href="#">?

jgonggrijp commented 3 days ago

Yes, I think an exception for href="#" (also with <area> elements) would be useful.