New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 817226 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Last visit > 30 days ago
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug



Sign in to add a comment

Floating keyboard jumps to unexpected places when you change the screen orientation

Project Member Reported by blakeo@chromium.org, Feb 28 2018

Issue description

The current positioning heuristic will anchor the keyboard to the closest edge of the screen and maintain the same distance when you change orientation. However, if you have a keyboard centered in a short and wide screen and then rotate the orientation, this creates a somewhat unexpected result.

For a simplified example, imagine a 600 x 300 screen with a keyboard that is 200 pixels wide. If this keyboard is centered in the bottom of the screen, my expectation is that when I rotate the screen to 300 x 600, it'll still be centered, 50 pixels from the left and right sides and touching the bottom. Instead, it is anchored to the right side with a margin of 200 pixels. The end result of this is that the keyboard gets pushed all the way to the bottom left corner (luckily valid bounds are ensured so that it doesn't actually get pushed off the left side). 

A possibly better heuristic is to maintain this information in the form of a ratio between left and right padding rather than strict pixel count. A keyboard anchored in the corner will still be in the same corner, although the pixel-count of the padding might change a bit, but a centered keyboard will stay centered.
 
Project Member

Comment 1 by bugdroid1@chromium.org, Feb 28 2018

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/d17de42cec53853011021f441540be740eb116e3

commit d17de42cec53853011021f441540be740eb116e3
Author: Blake O'Hare <blakeo@chromium.org>
Date: Wed Feb 28 07:59:34 2018

Floating keyboard: Change the screen orientation positioning heuristic

Previously, this would anchor the keyboard to the closest edge of the
screen in both the X and Y directions. When the screen orientation or
screen size changes, it would maintain the same pixel distance from
each of those sides. When the keyboard is intentionally anchored in a
corner, this works out great, but when the keyboard is centered along
an edge of the screen, this creates unexpected results since the
distribution of padding on either side of the keyboard has changed
significantly.

This simplifies the logic to simply maintain the ratio of padding on
either side of the keyboard in each direction (referred to in the code
as `[left_|top_]padding_allotment_ratio`. This records the percent of
the available padding that appears to the left or above the keyboard.
This ratio is maintained across screen size changes.

Updated unit test, which lacked non-corner test cases.

Bug:  817226 
Change-Id: I13e424f436aaa62cf8aa77626fa27985cbdf24a2
Reviewed-on: https://chromium-review.googlesource.com/940745
Reviewed-by: Yuichiro Hanada <yhanada@chromium.org>
Commit-Queue: Blake O'Hare <blakeo@chromium.org>
Cr-Commit-Position: refs/heads/master@{#539749}
[modify] https://crrev.com/d17de42cec53853011021f441540be740eb116e3/ui/keyboard/container_floating_behavior.cc
[modify] https://crrev.com/d17de42cec53853011021f441540be740eb116e3/ui/keyboard/container_floating_behavior.h
[modify] https://crrev.com/d17de42cec53853011021f441540be740eb116e3/ui/keyboard/container_floating_behavior_unittest.cc

Status: Fixed (was: Assigned)

Sign in to add a comment