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

[Chips] Move MDCChipField text input to a new line if text is too wide #9845

Merged

Conversation

bryanoltman
Copy link
Contributor

Updates MDCChipField to move the internal text field down to a new line if:

  1. The textField is on the same line as chips and becomes too long to fit
  2. The textField is on the line below chips but can fit on the line with chips

Fixes #9006

This completes the roll-forward of #9828

Before:
before 2020-03-03 15_08_50

After:
after 2020-03-03 15_10_39

@bryanoltman bryanoltman requested review from jverkoey and a team March 5, 2020 18:56
@material-automation
Copy link

bazel detected changes to the following targets:

//components/Chips:snapshot_tests
//components/Chips:snapshot_tests_test_bundle
//components/Chips:unit_tests
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3_test_bundle
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3_test_bundle
//components/Chips:unit_tests_environment
//components/Chips:unit_tests_environment_test_bundle

@material-automation
Copy link

bazel detected changes to the following targets:

//components/Chips:Chips
//components/Chips:ObjcExamples
//components/Chips:SwiftExamples
//components/Chips:Theming
//components/Chips:privateHeaders
//components/Chips:snapshot_test_lib
//components/Chips:snapshot_tests
//components/Chips:snapshot_tests.swift_runtime_linkopts
//components/Chips:snapshot_tests_test_binary
//components/Chips:snapshot_tests_test_bundle
//components/Chips:unit_test_sources
//components/Chips:unit_test_swift_sources
//components/Chips:unit_tests
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3.swift_runtime_linkopts
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3_test_binary
//components/Chips:unit_tests_IPAD_PRO_12_9_IN_9_3_test_bundle
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3.swift_runtime_linkopts
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3_test_binary
//components/Chips:unit_tests_IPHONE_7_PLUS_IN_10_3_test_bundle
//components/Chips:unit_tests_environment
//components/Chips:unit_tests_environment.swift_runtime_linkopts
//components/Chips:unit_tests_environment_test_binary
//components/Chips:unit_tests_environment_test_bundle
//components/schemes/Shape:ObjcExamples

Copy link
Contributor

@jverkoey jverkoey left a comment

Choose a reason for hiding this comment

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

No affected test?

Also: love the clarity of this code. Thank you! 🙏

@jverkoey
Copy link
Contributor

jverkoey commented Mar 5, 2020

As mentioned in the other thread, I'm somewhat under the UX impression that the chip input text field should always be on a newline to avoid the jumping behavior being coded here, but am not blocking this PR in terms of it being an iterative improvement.

@bryanoltman
Copy link
Contributor Author

@jverkoey This is kind of tough to test – setting the text programmatically (vs. entering it via keyboard) causes a layout pass, which masks the bug in snapshot tests. Is there a good way to simulate keyboard input? If so, I'll write a couple tests and land those before this PR.

@jverkoey
Copy link
Contributor

jverkoey commented Mar 5, 2020

Hmm we don't have any tests that I'm aware of that do text input simulation, so that may be a reasonable thing to file as a follow-up issue.

@bryanoltman bryanoltman merged commit 4cc8c3e into material-components:develop Mar 5, 2020
@bryanoltman bryanoltman deleted the MDCChipField-newline branch March 5, 2020 19:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Internal issue: b/144853451
4 participants