-
andaspain
My buttons, which I obviously create using the GB button block, would not show the styling I set for them correctly, no matter how hard I tried. So I inspected one of them and low and behold: it does not have any of the classes I applied to it, and is instead tagged as an a.
I checked in GB and yes, in the Settings pane the tag is an a. I did not check that because if I’m using a button block, I assume it’s tagged with the correct semantic tag. I am adding # in the button links for now because as I am building the site, I don’t have the internal links I need yet.
Is there anything I am doing wrong? Now that I know I will always check the tag, but it’s not the behaviour I expected. A button block that renders as an unlinked a tag is both semantically wrong and an accessibility failure, so I’m wondering whether I could be possibly making a mistake along the way because I don’t think GB would be set incorrectly. Thank you as ever for your help.
-
Hi there,
If you intend to add a link to the button, then selecting
<a>tag is the correct choice.<button>tag is used to trigger a certain action.Can you show me the button on your site?
-
andaspain
Thanks Ying, my point is that GenerateBlocks selected the
tag by default whenever I used a button block, which is not what I would expect (the # in the link was also automatically placed by GB before I could specify anything).These buttons are not for navigation, they are for taking an action, so even though technically they will contain a link,
<button>is the semantic element I want to use.So my question remains: it seems as if GB will automatically select the
tag when I use the button block, which matters also from a style point of view, because my button styles won’t apply.No big deal, I’ll just make sure I select the tag I deem correct manually.Thank you!
-
so even though technically they will contain a link, <button> is the semantic element I want to use.
<button>should never contain a link; make sure to remove the link if you choose<button>tag.So my question remains: it seems as if GB will automatically select the tag when I use the button block, which matters also from a style point of view, because my button styles won’t apply.
Yes, in most cases, people actually want to add a link, and they should be using
<a>tag.Can I see the button that you were referring to “my button styles won’t apply”? Can you specify the style that is missing?
- You must be logged in to reply to this topic.