Skip to content

add a focusNode to SearchAnchor.bar - #186073

Closed
lucavenir wants to merge 5 commits into
flutter:masterfrom
lucavenir:master
Closed

lucavenir wants to merge 5 commits into
flutter:masterfrom
lucavenir:master

Conversation

@lucavenir

@lucavenir lucavenir commented May 5, 2026 •

Copy link
Copy Markdown

As the title says; addresses #177454.
I wrote two trivial tests about this as well, any feedback is appreciated.

Pre-launch Checklist

@github-actions github-actions Bot added framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages labels May 5, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a focusNode parameter to the SearchAnchor.bar factory constructor and its internal implementation, enabling external control over the focus of the underlying SearchBar. Corresponding tests were added to verify the property's application and functionality. Feedback was provided regarding missing documentation for the new parameter in both public and private contexts, as required by the repository's style guide.

@dkwingsmt
dkwingsmt requested a review from QuncCccccc May 6, 2026 18:25

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM:) Thank you for your contribution!

super.enabled,
super.smartDashesType,
super.smartQuotesType,
FocusNode? focusNode,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

nit: maybe consider call it barFocusNode? because it doesn't control the view's text field.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

yes sure - it's worth the consistency

QuncCccccc
QuncCccccc previously approved these changes May 7, 2026
@lucavenir

Copy link
Copy Markdown
Author

let me address that last nit. I'll tag you ASAP once done

justinmc
justinmc previously approved these changes May 7, 2026

@justinmc justinmc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM 👍 . I agree with @QuncCccccc about barFocusNode though.

@justinmc justinmc added the CICD Run CI/CD label May 7, 2026
@lucavenir
lucavenir dismissed stale reviews from justinmc and QuncCccccc via f251ccf May 7, 2026 20:56
@github-actions github-actions Bot removed the CICD Run CI/CD label May 7, 2026
@lucavenir

lucavenir commented May 7, 2026 •

Copy link
Copy Markdown
Author

done. thank you for the quick feedback @QuncCccccc @justinmc

QuncCccccc
QuncCccccc previously approved these changes May 7, 2026

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Super nits below. LGTM again:)!

applied rename to test name

Co-authored-by: Qun Cheng <[email protected]>
applied rename to renamed parameter, again

Co-authored-by: Qun Cheng <[email protected]>
@lucavenir

Copy link
Copy Markdown
Author

done, again. neat!

@QuncCccccc QuncCccccc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM:)

@QuncCccccc QuncCccccc added the waiting for code freeze This PR is waiting for a code freeze to resolve. label May 7, 2026
@QuncCccccc
QuncCccccc marked this pull request as draft May 7, 2026 22:51
@QuncCccccc

Copy link
Copy Markdown
Contributor

Since this PR is ready to merge but we are in Material and Cupertino Code Freeze, I'm turning this PR into draft, like other material PRs. Once material_ui is ready, we can open a new PR over there with the same change:)!

@lucavenir

Copy link
Copy Markdown
Author

thank you! I totally forgot about that.

@Piinks Piinks added the Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. label Jun 24, 2026
@Piinks

Piinks commented Jun 24, 2026

Copy link
Copy Markdown
Contributor

I've marked this PR as not ready to port to flutter/packages yet.
We'll provide instructions to move this change over to material_ui/cupertino_ui once ready to receive PRs. Thank you!

@Piinks Piinks removed waiting for code freeze This PR is waiting for a code freeze to resolve. Decoupling: Not ready to port yet Instructions will be provided when this is ready to move to flutter/packages. labels Sep 9, 2026
@Piinks Piinks added the Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. label Sep 9, 2026
@Piinks

Piinks commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This PR is now ready to port over to flutter/packages! 🥳
See guidance and instructions in #188444

@lucavenir

Copy link
Copy Markdown
Author

I hope I did it right, here.

If anything's wrong, please, let me know!

@lucavenir lucavenir closed this Sep 14, 2026
auto-submit Bot pushed a commit to flutter/packages that referenced this pull request Oct 20, 2026
…r/flutter#186073) (#12863)

Ports flutter/flutter#186073 to `material_ui`, as per flutter/flutter#188444. The old PR (and tagged as `Decoupling: Port to flutter/packages`) was reviewed and approved by @QuncCccccc and @justinmc.

---

_quick recap_.

Fixes flutter/flutter#177454.

Adds a `barFocusNode` parameter to `SearchAnchor.bar` (and its internal `_SearchAnchorWithSearchBar` implementation), allowing external code to control the focus of the underlying `SearchBar`.

---

## Pre-Review Checklist
ValentinVignal pushed a commit to ValentinVignal/flutter that referenced this pull request Oct 21, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
LongCatIsLooong pushed a commit to LongCatIsLooong/flutter that referenced this pull request Oct 22, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
suryaKommana2662 pushed a commit to suryaKommana2662/flutter that referenced this pull request Oct 29, 2026
flutter/packages@618afba...1383427

2026-10-21 [email protected] [shared_preferences] Keep Kotlin
classes used through JNI in Android release builds
(flutter/packages#13311)
2026-10-20 [email protected] [webview_flutter_wkwebview] Roll back iOS
and macOS versions (flutter/packages#13354)
2026-10-20 [email protected] [camera]fix
resolution test failure due to hardware restriction
(flutter/packages#13356)
2026-10-20 [email protected] [google_maps_flutter_web] Fail fast and
deduplicate map setup in integration tests (flutter/packages#13092)
2026-10-20 [email protected] [camera_avfoundation] Fix Swift analyzer
issues in tests (flutter/packages#13340)
2026-10-20 [email protected] Sync release-material_ui-1.8.0 to
main (flutter/packages#13346)
2026-10-20 [email protected] [material_ui] add a `barFocusNode` to
`SearchAnchor.bar` (ref: flutter#186073)
(flutter/packages#12863)
2026-10-20 [email protected] [in_app_purchase_storekit] Expose
sk2Transaction on SK2PurchaseDetails (flutter/packages#13341)
2026-10-20 [email protected] Sync release-cupertino_ui-1.1.4 to
main (flutter/packages#13350)
2026-10-20 [email protected] [google_maps_flutter_web] Don't hang
`onMapCreated` when tiles fail to load (flutter/packages#13059)
2026-10-20 [email protected] [material_ui]
Unskip web tests that pass on CanvasKit and Skwasm:
adaptive_text_selection_toolbar_test, material_button_test,
outlined_button_test, text_button_test (flutter/packages#13335)
2026-10-20 [email protected] Sync release-go_router-18.1.1 to
main (flutter/packages#13347)
2026-10-20 [email protected] [camera] Add zero-shutter-lag support
to camera_android_camerax and camera_avfoundation
(flutter/packages#13199)

If this roll has caused a breakage, revert this CL and set the roller
to dry run mode using the controls here:
https://autoroll.skia.org/r/flutter-packages-flutter-autoroll
Please CC [email protected] on the revert to ensure that a
human
is aware of the problem.

To file a bug in Flutter:
https://github.com/flutter/flutter/issues/new/choose

To report a problem with the AutoRoller itself, please file a bug:
https://issues.skia.org/issues/new?component=1389291&template=1850622

Documentation for the AutoRoller is here:
https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Decoupling: Port to flutter/packages This PR is ready to be ported to flutter/packages. We will provide instructions to do so. framework flutter/packages/flutter repository. See also f: labels. p: material_ui material_ui package in flutter/packages

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants