• Resolved franklnx

    (@franklnx)


    Hello,
    after verifying that the plugin is working properly with respect to the blocks inserted in the pages, I noticed that the attributes cannot be inserted in the widget area blocks.
    Unfortunately, this is exactly what I was looking for: inserting aria-labels in the sidebar blocks to make the site more accessible.
    I read the plugin’s documentation but couldn’t find any references. Is there a restriction on the widget area blocks?

    Regards,

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author websevendev

    (@websevendev)

    Looks like it’s a bug.

    The reason you can’t add attributes in the Widget editor is because when the plugin is checking for wp.data.select('core/editor').canUserUseUnfilteredHTML() it returns false even though your user probably can use unfiltered HTML.

    Since this restriction is only client-side, as a workaround you can paste this code into the JavaScript console (F12 -> Console) and then you should be able to add attributes (may need to unselect and reselect the block so that it re-renders first):

    wp.data.select('core/editor').canUserUseUnfilteredHTML = () => true

    The workaround will stop working after you reload the page, but if your user does in fact have unfiltered_html capability then the attributes will persist and you can use the workaround again to edit them later.

    Thread Starter franklnx

    (@franklnx)

    Thank you for the quick response.
    The proposed solution makes the plugin usable in the widget area however it makes the work slightly longer. I was wondering: what do you mean by “bug” and “client-side restriction”? Basically what I would like to understand is if the proposed solution will always be needed, even in the future, or if there is hope for a permanent fix.

    Thank you very much for your support. Regards,

    Plugin Author websevendev

    (@websevendev)

    if the proposed solution will always be needed, even in the future, or if there is hope for a permanent fix

    The block editor team are in the process of unifying all the editors, so I would assume that it will start working eventually. Currently the editor is using the setting __experimentalCanUserUseUnfilteredHTML for determining this permission, so I will leave it for now, but once it is no longer experimental and still doesn’t work I’ll see if anything can be done on the plugin side.

    Thread Starter franklnx

    (@franklnx)

    Thank you, it is clear to me.
    However, despite the workaround and the ability to put attributes in the widget blocks, they do not appear in the html code.
    I tested the plugin with the page blocks and the attributes are inserted in the code, but this does not happen in the sidebar.
    Obviously after each modification I clear each cache. But there still seems to be a problem on the widget blocks.
    I will keep testing….

    Regards

    Thread Starter franklnx

    (@franklnx)

    Resolved (Attributes are present in the html code. Probably a caching problem).

    kamaldev

    (@kamaldev)

    I had use your plugin Attribute for Block . Its working perfect . But i want to add attributes on table thead tbody tr td element how can i do this

Viewing 6 replies - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.