MainView.anchorToKeyboard documentation unclear

Bug #1566713 reported by XiaoGuo, Liu
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
ubuntu-ui-toolkit (Ubuntu)
Confirmed
Undecided
Unassigned

Bug Description

 I am now trying to following the OSK at the link https://developer.ubuntu.com/en/apps/qml/tutorials/ubuntu-screen-keyboard-tricks/. I find that when i set anchorToKeyboard to true, the UI looks different from the one shown on the link.

When anchorToKeyboard: true, I cannot even see the input field for "username" and "password"? is this a bug? the UI is like http://imgur.com/wXaSzqG my test code is at https://github.com/liu-xiao-guo/osk

faenil helped to verify that if we set:

  Page {
        title: i18n.tr("onscreenkeyboard")
        anchors.fill: parent // this line makes the OSK work properly as expected on the link

        ....
  }

Best regards,
XiaoGuo

Revision history for this message
Andrea Bernabei (faenil) wrote :

I'm not familiar with Page code,
but I don't see any logic that would make it work without anchors there.

The Page is simply pushed up, and the content at the top slides under the header.

I verified that the same happens on UC 1.2 as well.

There are 2 options:
either
- it has always been broken, and should be handled better in the MainView/Page/whatever component
or
- it is working as designed and adding "anchorToKeyboard: true" is intended to just anchor to the bottom, the developer should be responsible for anchoring the Page to the top so that it resizes.

If the latter is true, the code on the tutorial is wrong (missing "anchors.fill: parent") and the documentation of anchorToKeyboard should probably say something about the anchors :)

Revision history for this message
Andrea Bernabei (faenil) wrote : Re: MainView's anchorToKeyboard does not work as expected

From the documentation of "anchorToKeyboard"

anchorToKeyboard : bool
The property holds if the application should automatically resize the contents when the input method appears

There doesn't seem to be any resizing being done, so either there is a bug in the code or in the documentation :)

summary: - OSK does not work as expected
+ MainView's anchorToKeyboard does not work as expected
Revision history for this message
XiaoGuo, Liu (liu-xiao-guo) wrote :

Is there any update on the bug report? I just want to know whether this is a bug or we need to take care of setting the flag to true.

Revision history for this message
Cris Dywan (kalikiana) wrote :

Ubuntu.Components 1.2 changes the height, 1.3 changes bottomMargin on the contents of the MainView. That qualifies as resizing to my mind. Maybe it should more explicitly say "resize the area holding the contents"?
And yes, "anchors.fill: true" should be used here, nothing forces a position or size on the actual children.

summary: - MainView's anchorToKeyboard does not work as expected
+ MainView.anchorToKeyboard documentation unclear
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in ubuntu-ui-toolkit (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.