Skip to content

Parsing "data-*" attributes #59532

@Lovor01

Description

@Lovor01

Description

It seems that data-* attributes are not parsed by hpq library and consequently not as a block attribute. Given their special nature I can understand that. This is perhaps a known issue, but I want to confirm that.

To clarify more, see below:

Step-by-step reproduction instructions

in blocks.json, block attribute definition

{
...
		"openSelector": {
			"type": "string",
			"source": "attribute",
			"attribute": "data-open-selector"
		},
...
}

result: openSelector attribute is undefined each time and causes This block contains unexpected or invalid content. error, since it is not parsed from the block. I use instead openSelector without "source" and "attribute" instead, so it is written in a block comments, but it would be nice to know if this is known and accepted issue, or bug.

Screenshots, screen recording, code snippet

No response

Environment info

No response

Please confirm that you have searched existing issues in the repo.

Yes

Please confirm that you have tested with all plugins deactivated except Gutenberg.

Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Block APIAPI that allows to express the block paradigm.[Feature] Block Validation/DeprecationHandling block validation to determine accuracy and deprecation[Status] Needs More InfoFollow-up required in order to be actionable.[Status] StaleGives the original author opportunity to update before closing. Can be reopened as needed.[Type] BugAn existing feature does not function as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions