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
=== modified file 'src/app/webbrowser/TabItem.qml'
--- src/app/webbrowser/TabItem.qml 2015-09-28 08:10:09 +0000
+++ src/app/webbrowser/TabItem.qml 2015-09-29 09:32:02 +0000
@@ -98,7 +98,7 @@
98 anchors.left: parent.left98 anchors.left: parent.left
99 anchors.top: parent.top99 anchors.top: parent.top
100 anchors.bottom: parent.bottom100 anchors.bottom: parent.bottom
101 anchors.right: closeButton.left101 anchors.right: parent.right
102 acceptedButtons: Qt.AllButtons102 acceptedButtons: Qt.AllButtons
103 onPressed: {103 onPressed: {
104 if (mouse.button === Qt.LeftButton) {104 if (mouse.button === Qt.LeftButton) {
@@ -118,21 +118,29 @@
118 id: closeButton118 id: closeButton
119 objectName: "closeButton"119 objectName: "closeButton"
120120
121 anchors.top: parent.top121 acceptedButtons: Qt.LeftButton | Qt.MiddleButton
122 anchors.bottom: parent.bottom
123 anchors.right: parent.right
124 width: units.gu(2)
125122
126 Icon {123 // On mobile the tap area to close the tab occupies the whole right
127 height: units.gu(1.5)124 // hand side of the tab, while it covers only the close icon in
128 width: height125 // other form factors
129 anchors.right: parent.right126 readonly property bool mobile: formFactor == "mobile"
130 anchors.rightMargin: units.gu(1)127 anchors.fill: mobile ? undefined : closeIcon
131 anchors.verticalCenter: parent.verticalCenter128 anchors.top: mobile ? parent.top : undefined
132 name: "close"129 anchors.bottom: mobile ? parent.bottom : undefined
133 }130 anchors.right: mobile ? parent.right : undefined
131 width: mobile ? units.gu(4) : closeIcon.width
134132
135 onClicked: closed()133 onClicked: closed()
136 }134 }
135
136 Icon {
137 id: closeIcon
138 height: units.gu(1.5)
139 width: height
140 anchors.right: parent.right
141 anchors.rightMargin: units.gu(1)
142 anchors.verticalCenter: parent.verticalCenter
143 name: "close"
144 }
137 }145 }
138}146}
139147
=== modified file 'tests/unittests/qml/tst_TabsBar.qml'
--- tests/unittests/qml/tst_TabsBar.qml 2015-09-24 05:41:14 +0000
+++ tests/unittests/qml/tst_TabsBar.qml 2015-09-29 09:32:02 +0000
@@ -211,12 +211,19 @@
211 compare(tabsModel.currentIndex, 1)211 compare(tabsModel.currentIndex, 1)
212 }212 }
213213
214 function test_close_tabs() {214 function test_close_tabs_data() {
215 return [
216 {button: Qt.LeftButton},
217 {button: Qt.MiddleButton}
218 ]
219 }
220
221 function test_close_tabs(data) {
215 populateTabs()222 populateTabs()
216 for (var i = 2; i >= 0; --i) {223 for (var i = 2; i >= 0; --i) {
217 var tab0 = getTabDelegate(0)224 var tab0 = getTabDelegate(0)
218 var closeButton = findChild(tab0, "closeButton")225 var closeButton = findChild(tab0, "closeButton")
219 clickItem(closeButton, Qt.LeftButton)226 clickItem(closeButton, data.button)
220 compare(tabsModel.count, i)227 compare(tabsModel.count, i)
221 }228 }
222 }229 }

Subscribers

People subscribed via source and target branches

to status/vote changes: