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

Refactor Focus page #10749

Closed
wants to merge 1 commit into from
Closed

Refactor Focus page #10749

wants to merge 1 commit into from

Conversation

atsansone
Copy link
Contributor

@atsansone atsansone commented Jun 14, 2024

Fixes #10168

Tech review approved in #10432

@flutter-website-bot
Copy link
Collaborator

flutter-website-bot commented Jun 14, 2024

Visit the preview URL for this PR (updated for commit 4d1b3ad):

https://flutter-docs-prod--pr10749-fix-10168-copy-qvo61uju.web.app

Copy link
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

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

I've finished reviewing about half of this page. I have concerns about the new structure/organization. I don't feel that it really makes the subject clearer.

@parlough, you filed this issue originally, was this the sort of thing you had in mind? I thought you meant that you might like more code examples, but I am not seeing that here. Please clarify.

Comment on lines +18 to +19
* To change focus on touch interfaces,
app users tap or click on the desired UI element.
Copy link
Contributor

Choose a reason for hiding this comment

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

It's ok up to here. But, in the overview, I think it's odd that you mention that the type of focus input depends on the input method, but then ONLY touch input is mentioned. I'd expect the overview to succinctly list all known types of input.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It does.

image

Comment on lines +21 to +27
* To change focus on traditional interfaces,
app users can use the mouse to click on the desired UI element
or press a keyboard shortcut to move focus.

Some examples of situations where you might need to know how to use the focus
system:
Once in focus, text entered with the keyboard flows to that element.
Text input could control objects or display text in a text field.
This continues until the focus moves to another element in the app.
Copy link
Contributor

Choose a reason for hiding this comment

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

This section doesn't list focus use cases. It only lists the traditional keyboard-based focus.

Also, it's incorrect to say "click on", the word lists says to use merely "click":
https://developers.google.com/style/word-list#click

I'd suggest removing this header (it's super short anyway, and not complete) and just finish the overview with both types of input.

- [Changing or defining the "tab order" of focus traversal in an application](#focustraversalpolicy)
- [Defining groups of controls that should be traversed together](#focustraversalgroup-widget)
- [Preventing some controls in an application from being focusable](#controlling-what-gets-focus)
:::secondary What you'll learn
Copy link
Contributor

@sfshaza2 sfshaza2 Jul 2, 2024

Choose a reason for hiding this comment

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

Why did you replace the list of focus use cases with "what you'll learn"? This isn't a tutorial. I put those use cases there for a VERY SPECIFIC reason. I wanted to make it very clear what situations might require fiddling with the focus. This new "what you'll learn" section doesn't convey the same info. And since we've already said that this guide doesn't apply to everyone, why treat it like a general tutorial?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The list of use cases that Greg added in his initial PR read as lacking context, so they were moved to When to use the focus system.

Comment on lines +172 to +175
Which node Flutter chooses depends upon the `disposition` argument
you give to `unfocus()`.
When calling `unfocus()`, you can set the `disposition` argument.
It allows two modes for passing focus:
Copy link
Contributor

@sfshaza2 sfshaza2 Jul 2, 2024

Choose a reason for hiding this comment

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

This text is verbose and duplicative. Why not make it more concise, such as:

Suggested change
Which node Flutter chooses depends upon the `disposition` argument
you give to `unfocus()`.
When calling `unfocus()`, you can set the `disposition` argument.
It allows two modes for passing focus:
Flutter chooses a new focus node depending on the `disposition` argument
you pass to `unfocus()`:

Comment on lines +177 to +181
* [`UnfocusDisposition.scope`][]:
The argument defaults to this option.
It gives the focus to the nearest parent focus scope.
If then something moves the focus to the next node with `FocusNode.nextFocus`,
the app starts with the "first" focusable item in the scope.
Copy link
Contributor

Choose a reason for hiding this comment

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

Again, I'd like to see this more concise:

Suggested change
* [`UnfocusDisposition.scope`][]:
The argument defaults to this option.
It gives the focus to the nearest parent focus scope.
If then something moves the focus to the next node with `FocusNode.nextFocus`,
the app starts with the "first" focusable item in the scope.
* [`UnfocusDisposition.scope`][] (default):
Flutter passes focus to the nearest parent focus scope.
After this, calling `FocusNode.nextFocus()` moves focus to the first
focusable widget in that scope.

Comment on lines -152 to +203
## Focus widget
* Attaches and detaches the focus node it owns from the focus tree
* Manages the attributes and callbacks of the focus node
* Enables discovery of focus nodes attached to the widget
tree through its static functions
Copy link
Contributor

Choose a reason for hiding this comment

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

Why did you replace this text with a bulleted list? Particularly following a header, it should prose, not a list. It's much harder to parse this way.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It starts with prose and goes to a bulleted list.

image

@sfshaza2
Copy link
Contributor

sfshaza2 commented Jul 2, 2024

Also, I tried viewing the staged version of this page and it was no longer available. I'd like to see that, once you do some restructuring.

@atsansone
Copy link
Contributor Author

/gcbrun

@RedBrogdon
Copy link
Contributor

I'm going to close this for now. This change will likely be picked up again at a later date, with attribution back to this PR.

@RedBrogdon RedBrogdon closed this Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
review.copy Awaiting Copy Review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

'Understanding Flutter's keyboard focus system' needs tech and copy review
4 participants