Merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/enoFocusPriSecItem into lp:ubuntu-ui-toolkit/staging

Proposed by Cris Dywan
Status: Merged
Approved by: Zsombor Egri
Approved revision: 1717
Merged at revision: 1721
Proposed branch: lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/enoFocusPriSecItem
Merge into: lp:ubuntu-ui-toolkit/staging
Diff against target: 75 lines (+41/-0)
2 files modified
src/Ubuntu/Components/1.3/TextField.qml (+2/-0)
tests/unit_x11/tst_components/tst_textinput_common13.qml (+39/-0)
To merge this branch: bzr merge lp:~ubuntu-sdk-team/ubuntu-ui-toolkit/enoFocusPriSecItem
Reviewer Review Type Date Requested Status
Zsombor Egri Approve
Albert Astals Cid (community) Needs Fixing
PS Jenkins bot continuous-integration Approve
Review via email: mp+277703@code.launchpad.net

Commit message

Enforce !activeFocusOnPress on TextField primary/secondaryItem

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Albert Astals Cid (aacid) wrote :

This does not fix the problem in my bug report.

review: Needs Fixing
Revision history for this message
Zsombor Egri (zsombi) wrote :

Good, one prerequisite to make sure overlay elements don't get focus.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Ubuntu/Components/1.3/TextField.qml'
2--- src/Ubuntu/Components/1.3/TextField.qml 2015-09-28 14:36:54 +0000
3+++ src/Ubuntu/Components/1.3/TextField.qml 2015-11-17 15:20:32 +0000
4@@ -870,6 +870,7 @@
5 for (var i = 0; i < children.length; i++) {
6 children[i].parent = leftPane;
7 children[i].anchors.verticalCenter = verticalCenter;
8+ children[i].activeFocusOnPress = false;
9 }
10 }
11 }
12@@ -892,6 +893,7 @@
13 for (var i = 0; i < children.length; i++) {
14 children[i].parent = rightPane;
15 children[i].anchors.verticalCenter = verticalCenter;
16+ children[i].activeFocusOnPress = false;
17 }
18 }
19 }
20
21=== modified file 'tests/unit_x11/tst_components/tst_textinput_common13.qml'
22--- tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-07-02 23:17:41 +0000
23+++ tests/unit_x11/tst_components/tst_textinput_common13.qml 2015-11-17 15:20:32 +0000
24@@ -96,6 +96,31 @@
25 TextField {
26 id: textField
27 }
28+
29+ TextField {
30+ id: customTextField
31+ text: 'Lorem ipsum dolor sit amet'
32+ primaryItem: AbstractButton {
33+ id: primaryButton
34+ height: parent.height
35+ width: height
36+ Image {
37+ anchors.fill: parent
38+ anchors.margins: units.gu(0.5)
39+ source: 'image://theme/torch-on'
40+ }
41+ }
42+ secondaryItem: AbstractButton {
43+ id: secondaryButton
44+ height: parent.height
45+ width: height
46+ Image {
47+ anchors.fill: parent
48+ anchors.margins: units.gu(0.5)
49+ source: 'image://theme/settings'
50+ }
51+ }
52+ }
53 TextArea {
54 id: textArea
55 }
56@@ -443,5 +468,19 @@
57 else
58 verify(popoverY >= 0, 'Popover went off-screen: %1'.arg(popoverY));
59 }
60+
61+ function test_secondaryItem_must_not_grab_focus() {
62+ var textField = customTextField;
63+ textField.forceActiveFocus();
64+ compare(textField.focus, true, 'TextField is focused');
65+
66+ var clearButton = findChild(textField, "clear_button")
67+ mouseClick(clearButton, clearButton.width/2, clearButton.height/2);
68+ compare(textField.focus, true, 'TextField remains focused');
69+ mouseClick(primaryButton, primaryButton.width/2, primaryButton.height/2);
70+ compare(textField.focus, true, 'TextField remains focused');
71+ mouseClick(secondaryButton, secondaryButton.width/2, secondaryButton.height/2);
72+ compare(textField.focus, true, 'TextField remains focused');
73+ }
74 }
75 }

Subscribers

People subscribed via source and target branches