Merge lp:~uriboni/webbrowser-app/larger-close-tab-button into lp:webbrowser-app

Proposed by Ugo Riboni
Status: Merged
Approved by: Olivier Tilloy
Approved revision: 1211
Merged at revision: 1211
Proposed branch: lp:~uriboni/webbrowser-app/larger-close-tab-button
Merge into: lp:webbrowser-app
Diff against target: 80 lines (+30/-15)
2 files modified
src/app/webbrowser/TabItem.qml (+21/-13)
tests/unittests/qml/tst_TabsBar.qml (+9/-2)
To merge this branch: bzr merge lp:~uriboni/webbrowser-app/larger-close-tab-button
Reviewer Review Type Date Requested Status
PS Jenkins bot continuous-integration Needs Fixing
Olivier Tilloy Approve
Review via email: mp+272557@code.launchpad.net

Commit message

Extend the clickable area to close a tab on mobile, as taps are less precise and often end up missing it.

Description of the change

Extend the clickable area to close a tab on mobile, as taps are less precise and often end up missing it

To post a comment you must log in.
Revision history for this message
Olivier Tilloy (osomon) wrote :

With this change the area looks correct on mobile, but it’s not on desktop.

To verify that, I added a semi-transparent red rectangle that fills the abstract button, and this is how it looks:

 - on desktop: http://people.canonical.com/~osomon/tab-close-button-desktop.png
 - on mobile: http://people.canonical.com/~osomon/tab-close-button-mobile.png

On desktop, the area shouldn’t cover the entire height of the tab, it should be limited to the height of the X icon. And the horizontal center of the area and that of the X icon should be aligned.

review: Needs Fixing
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
1207. By Ugo Riboni

Confine the close tab button to be as big as the icon on dekstop, while it covers the whole right hand side of the tab on mobile

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
Olivier Tilloy (osomon) wrote :

There are non-trivial conflicts when merging into the latest trunk. Can you please address them?

review: Needs Fixing
1208. By Ugo Riboni

Merge changes from trunk

1209. By Ugo Riboni

Merge branch: Allow closing a tab by middle-clicking on its X icon + tests

1210. By Ugo Riboni

Revert whitespace change

Revision history for this message
Olivier Tilloy (osomon) wrote :

That works well, but:

 - Is the change to the right anchor of mouseArea really needed? On mobile the closeButton mouse area hides mouseArea entirely anyway, no?

 - I find the anchoring code in closeButton hard to read, because the conditions are not consistent. Can you maybe add a read-only boolean property to mouseArea, and use that property consistently in anchors assignments? E.g.:

    readonly property bool mobile: formFactor == "mobile"
    anchors {
        fill: mobile ? undefined : closeIcon
        …
    }

1211. By Ugo Riboni

Clarify and simplify anchoring

Revision history for this message
Olivier Tilloy (osomon) wrote :

LGTM now, thanks!

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/app/webbrowser/TabItem.qml'
2--- src/app/webbrowser/TabItem.qml 2015-09-28 08:10:09 +0000
3+++ src/app/webbrowser/TabItem.qml 2015-09-29 09:32:02 +0000
4@@ -98,7 +98,7 @@
5 anchors.left: parent.left
6 anchors.top: parent.top
7 anchors.bottom: parent.bottom
8- anchors.right: closeButton.left
9+ anchors.right: parent.right
10 acceptedButtons: Qt.AllButtons
11 onPressed: {
12 if (mouse.button === Qt.LeftButton) {
13@@ -118,21 +118,29 @@
14 id: closeButton
15 objectName: "closeButton"
16
17- anchors.top: parent.top
18- anchors.bottom: parent.bottom
19- anchors.right: parent.right
20- width: units.gu(2)
21+ acceptedButtons: Qt.LeftButton | Qt.MiddleButton
22
23- Icon {
24- height: units.gu(1.5)
25- width: height
26- anchors.right: parent.right
27- anchors.rightMargin: units.gu(1)
28- anchors.verticalCenter: parent.verticalCenter
29- name: "close"
30- }
31+ // On mobile the tap area to close the tab occupies the whole right
32+ // hand side of the tab, while it covers only the close icon in
33+ // other form factors
34+ readonly property bool mobile: formFactor == "mobile"
35+ anchors.fill: mobile ? undefined : closeIcon
36+ anchors.top: mobile ? parent.top : undefined
37+ anchors.bottom: mobile ? parent.bottom : undefined
38+ anchors.right: mobile ? parent.right : undefined
39+ width: mobile ? units.gu(4) : closeIcon.width
40
41 onClicked: closed()
42 }
43+
44+ Icon {
45+ id: closeIcon
46+ height: units.gu(1.5)
47+ width: height
48+ anchors.right: parent.right
49+ anchors.rightMargin: units.gu(1)
50+ anchors.verticalCenter: parent.verticalCenter
51+ name: "close"
52+ }
53 }
54 }
55
56=== modified file 'tests/unittests/qml/tst_TabsBar.qml'
57--- tests/unittests/qml/tst_TabsBar.qml 2015-09-24 05:41:14 +0000
58+++ tests/unittests/qml/tst_TabsBar.qml 2015-09-29 09:32:02 +0000
59@@ -211,12 +211,19 @@
60 compare(tabsModel.currentIndex, 1)
61 }
62
63- function test_close_tabs() {
64+ function test_close_tabs_data() {
65+ return [
66+ {button: Qt.LeftButton},
67+ {button: Qt.MiddleButton}
68+ ]
69+ }
70+
71+ function test_close_tabs(data) {
72 populateTabs()
73 for (var i = 2; i >= 0; --i) {
74 var tab0 = getTabDelegate(0)
75 var closeButton = findChild(tab0, "closeButton")
76- clickItem(closeButton, Qt.LeftButton)
77+ clickItem(closeButton, data.button)
78 compare(tabsModel.count, i)
79 }
80 }

Subscribers

People subscribed via source and target branches

to status/vote changes: