I’ve noticed that the button from the drag and drop editor defaults to an anchor tag <a> instead of a <button>. To ensure proper markup and adhering to a11y practices, is there a way to make it a button instead for use cases where the button isn’t being used as a link and just create events?
Also, considering the use case above, is there a way to add an image/icon/svg into that button without using a link block as a container (if I am able to use the button tag)?
If you can, share your read-only link. It helps community members understand your issue.
Also, webflow has a element. Just view this post from Webflow University
Hi, thanks for your response. The site im working on is private so here is an old project link with just a regular button added in from Webflows “elements” panel. https://kabeh2.webflow.io/
If you click inspect on the “button” you will see it is an anchor tag <a></a> instead of a <button></button>.
I plan on using this button with interactions/events instead of using it as a link. Semantically it is incorrect to use the anchor tag in instances like this.
Tip: You can style this button in webflow. For that just insert the div or button element in webflow designer and style that after that apply that class to that button.
Yes, @Muhammad_Dilshad is correct. I misunderstood your query.
There is a wishlist item on creating a <button> block. But not much else from the Webflow Team on making this a possibility as shown in this thread.
Thanks again for jumping in on this .
It would be really great to just have a element from Webflow, as it’s super important for semantically correct code and accessibility. I’ve voted in the wishlist item mentioned by @whitakereditions.
The workaround I have come to for now is just using role="button" as a custom attribute. Other tags such as “aria-label” or “title” may be useful for accessibility.