You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As mentioned in commits 5311daa and bb958da, using links combined with JavaScript to generate POST (or, in this case, DELETE) requests to the server has a few issues. Quoting from the first of these commits:
First, screen readers will announce them as "links". People using screen readers usually associate links with "things that get you somewhere" and buttons with "things that perform an action". So when something like "Delete, link" is announced, they'll probably think this is a link which will take them to another page where they can delete a record.
Furthermore, the URL of the link for the "destroy" action might be the same as the URL for the "show" action (only one is accessed with a DELETE request and the other one with a GET request). That means screen readers could announce the link like "Delete, visited link", which is very confusing.
These links won't work when opening links in a new tab, since opening links in a new tab always results in a GET request to the URL the link points to.
Finally, submit buttons work without JavaScript enabled, so they'll work even if the JavaScript in the page hasn't loaded (for whatever reason).
Implementation details
See pull request #5459 for an example, since this pull request does the exact same thing for links in the admin section. Don't use the Admin::ActionComponent class, though; either replace link_to with button_to or create a new Shared::ActionComponent class.
Here's a patch adding a # TODO element to the places where we detected this is needed. Note the patch was based on version 2.1.1, so it's possible that it doesn't apply cleanly if you're using a more recent version of Consul Democracy.
User Story
As mentioned in commits 5311daa and bb958da, using links combined with JavaScript to generate POST (or, in this case, DELETE) requests to the server has a few issues. Quoting from the first of these commits:
Implementation details
See pull request #5459 for an example, since this pull request does the exact same thing for links in the admin section. Don't use the
Admin::ActionComponent
class, though; either replacelink_to
withbutton_to
or create a newShared::ActionComponent
class.Here's a patch adding a
# TODO
element to the places where we detected this is needed. Note the patch was based on version 2.1.1, so it's possible that it doesn't apply cleanly if you're using a more recent version of Consul Democracy.The text was updated successfully, but these errors were encountered: