Merge lp:~tpeeters/ubuntu-ui-toolkit/sections-keyboard into lp:ubuntu-ui-toolkit/staging

Proposed by Tim Peeters
Status: Merged
Approved by: Cris Dywan
Approved revision: 1963
Merged at revision: 1959
Proposed branch: lp:~tpeeters/ubuntu-ui-toolkit/sections-keyboard
Merge into: lp:ubuntu-ui-toolkit/staging
Prerequisite: lp:~tpeeters/ubuntu-ui-toolkit/hor-ListView-nav
Diff against target: 158 lines (+38/-18)
4 files modified
src/Ubuntu/Components/1.3/Sections.qml (+1/-0)
src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml (+13/-14)
src/Ubuntu/Components/plugin/uclistitem.cpp (+2/-0)
tests/unit_x11/tst_components/tst_focus.qml (+22/-4)
To merge this branch: bzr merge lp:~tpeeters/ubuntu-ui-toolkit/sections-keyboard
Reviewer Review Type Date Requested Status
ubuntu-sdk-build-bot continuous-integration Approve
Cris Dywan Approve
Review via email: mp+292587@code.launchpad.net

Commit message

Sections keyboard and focus handling.

To post a comment you must log in.
1953. By Tim Peeters

clean

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

This should be covered by tests/unit_x11/tst_components/tst_focus.qml me thinks (or possibly a separate one if it makes sense).

review: Needs Fixing
1954. By Tim Peeters

hide blue underline when doing keyboard navigation

1955. By Tim Peeters

hide underline for keyboard-focused selection

Revision history for this message
Tim Peeters (tpeeters) wrote :

> This should be covered by tests/unit_x11/tst_components/tst_focus.qml me
> thinks (or possibly a separate one if it makes sense).

The focus is the same as the ListView/ListItem focus for which I added test cases here https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/hor-ListView-nav/+merge/292542

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

> > This should be covered by tests/unit_x11/tst_components/tst_focus.qml me
> > thinks (or possibly a separate one if it makes sense).
>
> The focus is the same as the ListView/ListItem focus for which I added test
> cases here https://code.launchpad.net/~tpeeters/ubuntu-ui-toolkit/hor-
> ListView-nav/+merge/292542

Sure. Still we need a test to assert that it's actually working with Sections. Whether that means that you add it there or to tst_focus is less important, but right now no test fails without this MR right here.

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
1956. By Tim Peeters

fix warning in unit test

1957. By Tim Peeters

update tst_focus

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

I notice a visual glitch: there's always white space on the right side of the focus frame. Or in other words it looks like a thin white line. It's not on both sides so I assume it's not expected.

review: Needs Information
1958. By Tim Peeters

add FIXME

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
1959. By Tim Peeters

sync staging

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Needs Fixing (continuous-integration)
1960. By Tim Peeters

update key focus test

1961. By Tim Peeters

clean

1962. By Tim Peeters

clean

1963. By Tim Peeters

remove unneeded waitForRendering(button)

Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
Cris Dywan (kalikiana) wrote :

Thanks for adding the FIXME for the margin and adapting the test case.

Looks rather nice now!

review: Approve
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)
Revision history for this message
ubuntu-sdk-build-bot (ubuntu-sdk-build-bot) wrote :
review: Approve (continuous-integration)

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/Sections.qml'
2--- src/Ubuntu/Components/1.3/Sections.qml 2016-01-06 17:59:06 +0000
3+++ src/Ubuntu/Components/1.3/Sections.qml 2016-04-26 13:22:08 +0000
4@@ -29,6 +29,7 @@
5 StyledItem {
6 id: sections
7 styleName: "SectionsStyle"
8+ activeFocusOnTab: true
9
10 /*!
11 List of actions that represent the sections.
12
13=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml'
14--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-03-02 16:05:40 +0000
15+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-04-26 13:22:08 +0000
16@@ -89,7 +89,6 @@
17 objectName: "sections_listview"
18
19 property bool animateContentX: false
20- activeFocusOnTab: false // FIXME: Enable proper focus handling
21
22 // Position the selected item correctly.
23 // For a scrollable ListView, if the item was already fully visible,
24@@ -167,6 +166,9 @@
25 x: sectionsListView.currentItem ? sectionsListView.currentItem.x : -width
26 width: sectionsListView.currentItem ? sectionsListView.currentItem.width : 0
27 height: sectionsListView.currentItem ? sectionsListView.currentItem.height : 0
28+ // Hide the highlight underline when the ListItem has the focus frame enabled:
29+ visible: sectionsListView.currentItem &&
30+ !sectionsListView.currentItem.keyNavigationFocus
31
32 Rectangle {
33 anchors {
34@@ -180,24 +182,24 @@
35 Behavior on x { UbuntuNumberAnimation {} }
36 }
37
38- delegate: AbstractButton {
39+ delegate: ListItem {
40 id: sectionButton
41 activeFocusOnTab: false
42 objectName: "section_button_" + index
43 width: label.width + 2 * sectionsStyle.horizontalLabelSpacing
44 height: sectionsStyle.height
45+ // No need to clip
46+ contentItem.clip: false
47+
48 property bool selected: index === styledItem.selectedIndex
49 onClicked: {
50 styledItem.selectedIndex = index;
51 sectionsListView.forceActiveFocus();
52 }
53
54- // Background pressed highlight
55- Rectangle {
56- visible: parent.pressed
57- anchors.fill: parent
58- color: sectionsStyle.pressedBackgroundColor
59- }
60+ // FIXME: This line may be removed when bug #1573215 is fixed and
61+ // ListItems in a horizontal ListView don't show the divider by default
62+ divider.visible: false
63
64 // Section title
65 Label {
66@@ -207,12 +209,7 @@
67 text: modelData.hasOwnProperty("text") ? modelData.text : modelData
68 textSize: sectionsStyle.textSize
69 font.weight: Font.Light
70- anchors {
71- baseline: underline.bottom
72- baselineOffset: sectionsStyle.height < units.gu(4) ? -units.gu(1) : -units.gu(2)
73- horizontalCenter: parent.horizontalCenter
74- }
75-
76+ anchors.centerIn: parent
77 color: sectionButton.selected ?
78 sectionsStyle.selectedSectionColor :
79 sectionsStyle.sectionColor
80@@ -232,6 +229,8 @@
81 }
82 height: sectionsStyle.underlineHeight
83 color: sectionsStyle.underlineColor
84+ // Don't cover the focus frame:
85+ visible: !sectionButton.keyNavigationFocus
86 }
87 }
88
89
90=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
91--- src/Ubuntu/Components/plugin/uclistitem.cpp 2016-04-20 15:00:27 +0000
92+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-04-26 13:22:08 +0000
93@@ -1140,6 +1140,8 @@
94 updateNode = true;
95 }
96 QRectF rect(boundingRect());
97+ // FIXME: The 1dp margin is here so that part of the focus frame
98+ // is not hidden by the APL divider. See bug #1575060.
99 rect -= QMarginsF(0, 0, UCUnits::instance()->dp(1), 0);
100 d->divider->setOpacity(paintFocus ? 0.0 : 1.0);
101 rectNode->setRect(rect);
102
103=== modified file 'tests/unit_x11/tst_components/tst_focus.qml'
104--- tests/unit_x11/tst_components/tst_focus.qml 2016-04-26 05:33:41 +0000
105+++ tests/unit_x11/tst_components/tst_focus.qml 2016-04-26 13:22:08 +0000
106@@ -85,6 +85,14 @@
107 Slider {
108 id: slider
109 }
110+ Sections {
111+ id: sections
112+ actions: [
113+ Action { text: "Section 1" },
114+ Action { text: "Section 2" },
115+ Action { text: "Section 3" }
116+ ]
117+ }
118 Button {
119 id: dummy2
120 }
121@@ -239,8 +247,12 @@
122 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},
123 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},
124 {tag: "Switch(back)", from: slider, to: switchbox, key: Qt.Key_Backtab},
125- {tag: "Slider", from: slider, to: dummy2, key: Qt.Key_Tab},
126- {tag: "Slider(back)", from: dummy2, to: slider, key: Qt.Key_Backtab},
127+ {tag: "Slider", from: slider, to: sections, key: Qt.Key_Tab, keyFocusItem: "section_button_0"},
128+ {tag: "Slider(back)", from: sections, to: slider, key: Qt.Key_Backtab},
129+ // NOTE: Navigation INSIDE the sections using the arrow keys is tested
130+ // in tst_sections.qml.
131+ {tag: "Sections", from: sections, to: dummy2, key: Qt.Key_Tab},
132+ {tag: "Sections(back)", from:dummy2, to: sections, key: Qt.Key_Backtab, keyFocusItem: "section_button_0"},
133 /* FIXME: Figure out how to test ActionBar delegate focus
134 {tag: "ActionBar", from: 'actionBarShare_button', to: picker, key: Qt.Key_Tab},
135 {tag: "ActionBar(back)", from: picker, to: 'actionBarShare_button', key: Qt.Key_Backtab},
136@@ -267,7 +279,14 @@
137 } else {
138 verify(data.to.activeFocusOnTab, "Target doesn't take keyboard focus");
139 keyClick(data.key);
140- verify(data.to.keyNavigationFocus, "Target doesn't have keyNavigationFocus");
141+
142+ if (data.keyFocusItem) {
143+ var child = findChild(data.to, data.keyFocusItem);
144+ verify(child, "Target does not have child with objectName "+data.keyFocusItem);
145+ verify(child.keyNavigationFocus, "Target child does not have keyNavigationFocus");
146+ } else {
147+ verify(data.to.keyNavigationFocus, "Target does not have keyNavigationFocus");
148+ }
149 }
150 waitForRendering(data.to, 500);
151 verify(!data.from.activeFocus, "Source component still keeps focus");
152@@ -410,7 +429,6 @@
153 buttonTriggerSpy.target = button;
154 button.forceActiveFocus();
155 keyClick(data.key);
156- waitForRendering(button);
157 buttonTriggerSpy.wait();
158 }
159

Subscribers

People subscribed via source and target branches