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

Interactivity API Docs: Add initial version of getContext and getElement #59293

Merged
merged 3 commits into from
Feb 26, 2024

Conversation

cbravobernal
Copy link
Contributor

What?

Add getElement and getContext functions to the API Reference in Interactivity API.

Why?

Those functions will be widely used. In special getContext(). Should be added to the dev note and be referenced in the docs.

@cbravobernal cbravobernal added [Type] Developer Documentation Documentation for developers [Packages] Interactivity /packages/interactivity labels Feb 22, 2024
@cbravobernal cbravobernal self-assigned this Feb 22, 2024
@cbravobernal cbravobernal requested a review from ndiego February 22, 2024 22:22
Copy link

github-actions bot commented Feb 22, 2024

The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the props-bot label.

If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message.

Co-authored-by: c4rl0sbr4v0 <[email protected]>
Co-authored-by: fabiankaegy <[email protected]>

To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook.

Copy link
Member

@fabiankaegy fabiankaegy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great :) Thanks for addig these!

Comment on lines +1014 to +1016
##### ref

`ref` is the reference to the DOM element as an (HTMLElement)[https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What I think would be good to document more clearly is that it returns a referece of the element that the action for example is bound to / called from.

I initially expected it to return a reference to the block wrapping element instead. Kind of like the getContext gets the wrapping context.

@cbravobernal cbravobernal enabled auto-merge (squash) February 26, 2024 07:40
@cbravobernal cbravobernal merged commit 702f78a into trunk Feb 26, 2024
56 checks passed
@cbravobernal cbravobernal deleted the docs/add-get-context-element-interactivity branch February 26, 2024 08:07
@github-actions github-actions bot added this to the Gutenberg 17.9 milestone Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Packages] Interactivity /packages/interactivity [Type] Developer Documentation Documentation for developers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants