Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsing "data-*" attributes #59532

Open
Lovor01 opened this issue Mar 3, 2024 · 2 comments
Open

Parsing "data-*" attributes #59532

Lovor01 opened this issue Mar 3, 2024 · 2 comments
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Block Validation/Deprecation Handling block validation to determine accuracy and deprecation [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended

Comments

@Lovor01
Copy link
Contributor

Lovor01 commented Mar 3, 2024

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

@Lovor01 Lovor01 added the [Type] Bug An existing feature does not function as intended label Mar 3, 2024
@jordesign jordesign added [Feature] Blocks Overall functionality of blocks Needs Testing Needs further testing to be confirmed. labels Mar 3, 2024
@t-hamano
Copy link
Contributor

t-hamano commented Mar 4, 2024

Thanks for the report.

data-* attributes are also used in core blocks.

Table Block:

"align": {
"type": "string",
"source": "attribute",
"attribute": "data-align"
},

GalleryBlock:

"fullUrl": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-full-url"
},
"link": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-link"
},
"alt": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "alt",
"default": ""
},
"id": {
"type": "string",
"source": "attribute",
"selector": "img",
"attribute": "data-id"
},

result: openSelector attribute is undefined each time and causes This block contains unexpected or invalid content.

Could you tell us specifically what kind of errors are logged?

@t-hamano t-hamano added [Status] Needs More Info Follow-up required in order to be actionable. [Block] Time to Read Affects the Time to Read Block [Feature] Block Validation/Deprecation Handling block validation to determine accuracy and deprecation and removed Needs Testing Needs further testing to be confirmed. [Block] Time to Read Affects the Time to Read Block [Feature] Blocks Overall functionality of blocks labels Mar 4, 2024
@gziolo gziolo added the [Feature] Block API API that allows to express the block paradigm. label Mar 8, 2024
Copy link

Help us move this issue forward. This issue is being marked stale since it has no activity after 15 days of requesting more information. Please add info requested so we can help move the issue forward. Note: The triage policy is to close stale issues that need more info and no response after 2 weeks.

@github-actions github-actions bot added the [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. label Mar 24, 2024
@gziolo gziolo mentioned this issue Oct 10, 2024
69 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Block API API that allows to express the block paradigm. [Feature] Block Validation/Deprecation Handling block validation to determine accuracy and deprecation [Status] Needs More Info Follow-up required in order to be actionable. [Status] Stale Gives the original author opportunity to update before closing. Can be reopened as needed. [Type] Bug An existing feature does not function as intended
Projects
None yet
Development

No branches or pull requests

4 participants