Skip to content

feat(ui5-shellbar): introduce async search btn getter #11338

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

Merged
merged 3 commits into from
Apr 17, 2025

Conversation

dobrinyonkov
Copy link
Contributor

The searchButtonDomRef has been refactored into an asynchronous method getSearchButtonDomRef that waits for the component to finish rendering. This ensures the DOM is available for use cases that require focusing the search button.

A similar code has been applied to the search-field-toggle event, which is now fired after rendering is complete.

@dobrinyonkov dobrinyonkov force-pushed the shellbar-search-btn-async-get branch from f4ad58d to 9cc4b22 Compare April 16, 2025 05:52
@dobrinyonkov dobrinyonkov requested a review from Copilot April 16, 2025 05:53
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors the asynchronous handling of the search button by replacing the synchronous getter with an async method and updating event handling to ensure the DOM is fully rendered when focused.

  • Changed the synchronous searchButtonDomRef getter to an asynchronous getSearchButtonDomRef method.
  • Updated event listeners in test pages to wait for rendering and focus the appropriate elements.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
packages/fiori/test/pages/ShellBar_evolution.html Adjusted event listener logic to wait for the search-field-toggle.
packages/fiori/src/ShellBar.ts Replaced the synchronous DOM ref getter with an asynchronous method.
Comments suppressed due to low confidence (2)

packages/fiori/src/ShellBar.ts:1062

  • [nitpick] Update the JSDoc comments to reflect that this method is asynchronous and returns a Promise, ensuring consistency between the documentation and its behavior.
async getSearchButtonDomRef(): Promise<HTMLElement | null> {

packages/fiori/test/pages/ShellBar_evolution.html:306

  • Consider verifying that registering the 'ui5-search-field-toggle' listener inside the 'ui5-search-button-click' handler is the intended design, as it may lead to unexpected multiple registrations if the click event is fired repeatedly before the inner listener has been invoked.
shellbar_hide_search.addEventListener('ui5-search-field-toggle', async (e) => {

@dobrinyonkov dobrinyonkov merged commit d5526dc into main Apr 17, 2025
12 checks passed
@dobrinyonkov dobrinyonkov deleted the shellbar-search-btn-async-get branch April 17, 2025 07:12
@ui5-webcomponents-bot
Copy link
Collaborator

🎉 This PR is included in version v2.10.0-rc.1 🎉

The release is available on v2.10.0-rc.1

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants