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
=== modified file 'src/Ubuntu/Components/1.3/Sections.qml'
--- src/Ubuntu/Components/1.3/Sections.qml 2016-01-06 17:59:06 +0000
+++ src/Ubuntu/Components/1.3/Sections.qml 2016-04-26 13:22:08 +0000
@@ -29,6 +29,7 @@
29StyledItem {29StyledItem {
30 id: sections30 id: sections
31 styleName: "SectionsStyle"31 styleName: "SectionsStyle"
32 activeFocusOnTab: true
3233
33 /*!34 /*!
34 List of actions that represent the sections.35 List of actions that represent the sections.
3536
=== modified file 'src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml'
--- src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-03-02 16:05:40 +0000
+++ src/Ubuntu/Components/Themes/Ambiance/1.3/SectionsStyle.qml 2016-04-26 13:22:08 +0000
@@ -89,7 +89,6 @@
89 objectName: "sections_listview"89 objectName: "sections_listview"
9090
91 property bool animateContentX: false91 property bool animateContentX: false
92 activeFocusOnTab: false // FIXME: Enable proper focus handling
9392
94 // Position the selected item correctly.93 // Position the selected item correctly.
95 // For a scrollable ListView, if the item was already fully visible,94 // For a scrollable ListView, if the item was already fully visible,
@@ -167,6 +166,9 @@
167 x: sectionsListView.currentItem ? sectionsListView.currentItem.x : -width166 x: sectionsListView.currentItem ? sectionsListView.currentItem.x : -width
168 width: sectionsListView.currentItem ? sectionsListView.currentItem.width : 0167 width: sectionsListView.currentItem ? sectionsListView.currentItem.width : 0
169 height: sectionsListView.currentItem ? sectionsListView.currentItem.height : 0168 height: sectionsListView.currentItem ? sectionsListView.currentItem.height : 0
169 // Hide the highlight underline when the ListItem has the focus frame enabled:
170 visible: sectionsListView.currentItem &&
171 !sectionsListView.currentItem.keyNavigationFocus
170172
171 Rectangle {173 Rectangle {
172 anchors {174 anchors {
@@ -180,24 +182,24 @@
180 Behavior on x { UbuntuNumberAnimation {} }182 Behavior on x { UbuntuNumberAnimation {} }
181 }183 }
182184
183 delegate: AbstractButton {185 delegate: ListItem {
184 id: sectionButton186 id: sectionButton
185 activeFocusOnTab: false187 activeFocusOnTab: false
186 objectName: "section_button_" + index188 objectName: "section_button_" + index
187 width: label.width + 2 * sectionsStyle.horizontalLabelSpacing189 width: label.width + 2 * sectionsStyle.horizontalLabelSpacing
188 height: sectionsStyle.height190 height: sectionsStyle.height
191 // No need to clip
192 contentItem.clip: false
193
189 property bool selected: index === styledItem.selectedIndex194 property bool selected: index === styledItem.selectedIndex
190 onClicked: {195 onClicked: {
191 styledItem.selectedIndex = index;196 styledItem.selectedIndex = index;
192 sectionsListView.forceActiveFocus();197 sectionsListView.forceActiveFocus();
193 }198 }
194199
195 // Background pressed highlight200 // FIXME: This line may be removed when bug #1573215 is fixed and
196 Rectangle {201 // ListItems in a horizontal ListView don't show the divider by default
197 visible: parent.pressed202 divider.visible: false
198 anchors.fill: parent
199 color: sectionsStyle.pressedBackgroundColor
200 }
201203
202 // Section title204 // Section title
203 Label {205 Label {
@@ -207,12 +209,7 @@
207 text: modelData.hasOwnProperty("text") ? modelData.text : modelData209 text: modelData.hasOwnProperty("text") ? modelData.text : modelData
208 textSize: sectionsStyle.textSize210 textSize: sectionsStyle.textSize
209 font.weight: Font.Light211 font.weight: Font.Light
210 anchors {212 anchors.centerIn: parent
211 baseline: underline.bottom
212 baselineOffset: sectionsStyle.height < units.gu(4) ? -units.gu(1) : -units.gu(2)
213 horizontalCenter: parent.horizontalCenter
214 }
215
216 color: sectionButton.selected ?213 color: sectionButton.selected ?
217 sectionsStyle.selectedSectionColor :214 sectionsStyle.selectedSectionColor :
218 sectionsStyle.sectionColor215 sectionsStyle.sectionColor
@@ -232,6 +229,8 @@
232 }229 }
233 height: sectionsStyle.underlineHeight230 height: sectionsStyle.underlineHeight
234 color: sectionsStyle.underlineColor231 color: sectionsStyle.underlineColor
232 // Don't cover the focus frame:
233 visible: !sectionButton.keyNavigationFocus
235 }234 }
236 }235 }
237236
238237
=== modified file 'src/Ubuntu/Components/plugin/uclistitem.cpp'
--- src/Ubuntu/Components/plugin/uclistitem.cpp 2016-04-20 15:00:27 +0000
+++ src/Ubuntu/Components/plugin/uclistitem.cpp 2016-04-26 13:22:08 +0000
@@ -1140,6 +1140,8 @@
1140 updateNode = true;1140 updateNode = true;
1141 }1141 }
1142 QRectF rect(boundingRect());1142 QRectF rect(boundingRect());
1143 // FIXME: The 1dp margin is here so that part of the focus frame
1144 // is not hidden by the APL divider. See bug #1575060.
1143 rect -= QMarginsF(0, 0, UCUnits::instance()->dp(1), 0);1145 rect -= QMarginsF(0, 0, UCUnits::instance()->dp(1), 0);
1144 d->divider->setOpacity(paintFocus ? 0.0 : 1.0);1146 d->divider->setOpacity(paintFocus ? 0.0 : 1.0);
1145 rectNode->setRect(rect);1147 rectNode->setRect(rect);
11461148
=== modified file 'tests/unit_x11/tst_components/tst_focus.qml'
--- tests/unit_x11/tst_components/tst_focus.qml 2016-04-26 05:33:41 +0000
+++ tests/unit_x11/tst_components/tst_focus.qml 2016-04-26 13:22:08 +0000
@@ -85,6 +85,14 @@
85 Slider {85 Slider {
86 id: slider86 id: slider
87 }87 }
88 Sections {
89 id: sections
90 actions: [
91 Action { text: "Section 1" },
92 Action { text: "Section 2" },
93 Action { text: "Section 3" }
94 ]
95 }
88 Button {96 Button {
89 id: dummy297 id: dummy2
90 }98 }
@@ -239,8 +247,12 @@
239 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},247 {tag: "CheckBox", from: switchbox, to: checkbox, key: Qt.Key_Backtab},
240 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},248 {tag: "Switch", from: switchbox, to: slider, key: Qt.Key_Tab},
241 {tag: "Switch(back)", from: slider, to: switchbox, key: Qt.Key_Backtab},249 {tag: "Switch(back)", from: slider, to: switchbox, key: Qt.Key_Backtab},
242 {tag: "Slider", from: slider, to: dummy2, key: Qt.Key_Tab},250 {tag: "Slider", from: slider, to: sections, key: Qt.Key_Tab, keyFocusItem: "section_button_0"},
243 {tag: "Slider(back)", from: dummy2, to: slider, key: Qt.Key_Backtab},251 {tag: "Slider(back)", from: sections, to: slider, key: Qt.Key_Backtab},
252 // NOTE: Navigation INSIDE the sections using the arrow keys is tested
253 // in tst_sections.qml.
254 {tag: "Sections", from: sections, to: dummy2, key: Qt.Key_Tab},
255 {tag: "Sections(back)", from:dummy2, to: sections, key: Qt.Key_Backtab, keyFocusItem: "section_button_0"},
244 /* FIXME: Figure out how to test ActionBar delegate focus256 /* FIXME: Figure out how to test ActionBar delegate focus
245 {tag: "ActionBar", from: 'actionBarShare_button', to: picker, key: Qt.Key_Tab},257 {tag: "ActionBar", from: 'actionBarShare_button', to: picker, key: Qt.Key_Tab},
246 {tag: "ActionBar(back)", from: picker, to: 'actionBarShare_button', key: Qt.Key_Backtab},258 {tag: "ActionBar(back)", from: picker, to: 'actionBarShare_button', key: Qt.Key_Backtab},
@@ -267,7 +279,14 @@
267 } else {279 } else {
268 verify(data.to.activeFocusOnTab, "Target doesn't take keyboard focus");280 verify(data.to.activeFocusOnTab, "Target doesn't take keyboard focus");
269 keyClick(data.key);281 keyClick(data.key);
270 verify(data.to.keyNavigationFocus, "Target doesn't have keyNavigationFocus");282
283 if (data.keyFocusItem) {
284 var child = findChild(data.to, data.keyFocusItem);
285 verify(child, "Target does not have child with objectName "+data.keyFocusItem);
286 verify(child.keyNavigationFocus, "Target child does not have keyNavigationFocus");
287 } else {
288 verify(data.to.keyNavigationFocus, "Target does not have keyNavigationFocus");
289 }
271 }290 }
272 waitForRendering(data.to, 500);291 waitForRendering(data.to, 500);
273 verify(!data.from.activeFocus, "Source component still keeps focus");292 verify(!data.from.activeFocus, "Source component still keeps focus");
@@ -410,7 +429,6 @@
410 buttonTriggerSpy.target = button;429 buttonTriggerSpy.target = button;
411 button.forceActiveFocus();430 button.forceActiveFocus();
412 keyClick(data.key);431 keyClick(data.key);
413 waitForRendering(button);
414 buttonTriggerSpy.wait();432 buttonTriggerSpy.wait();
415 }433 }
416434

Subscribers

People subscribed via source and target branches