New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Touch dashboards #775
Touch dashboards #775
Conversation
Finally ready! Since it's virtually impossible to detect if you have an user with a mouse or with a touch device... and you shouldn't design differently for either case anyway, I ended up going another route. I believe the end result is even better. Now in order to rearrange the dashboards you have two options:
To stop rearranging, either 1) click the same "rearranging" button, 2) click the "black toast" that appears in the bottom, 3) click anywhere that's not a dashboard item, e.g. on an empty cell 4) click ESC or 5) click the browser back button. I've been playing with it and it works really intuitively for me on both desktop and mobile modes (on my phone, didn't try on a tablet yet). Still to do to have everything perfect:
Also in this PR I did a few other things:
|
Annoyingly I don't think this is an improvement over what we currently have for dashboard
I understand this is a much better solution on mobile but 90% of our traffic at the moment is desktop so I'm in favour of optimising for that. Edit: Having the dashboards in the sidebar is v cool, it would maybe be worth putting them in a slightly different section from the rest of the links, maybe just at the bottom (or top!) with a |
Hi, I see your points and I'm open for suggestions to improve it. I'd totally like to have the dashboard start moving without having to do a second click/tap, but I ran into limitations with the libraries used and figured it to be a practical compromise for now. This can be fixed though. Regarding the animation and performance. Obviously if it's lagging, we need an alternative solution. I'd like to add a counterpoint to the 90% statement though. The current dashboards are unusable on mobile. I've spent the last hour using app.posthog.com on my phone and the experience was terrible. As a site owner, I like to often check my stats on my phone. I know people who check their dashboards on their phone before going to sleep every day. I think it's crucial that posthog works well on a touch device... And that can't be an afterthought that we install later. I however agree with you that the current version is a slight downgrade when used with a mouse or a touchpad. Long clicking is indeed not the most intuitive thing. |
Hi! I added a divider between the pinned dashboard items in the sidebar and the rest: Regarding the logic with dragging, after having a night to sleep over it, I still believe we should make the app work well on mobile. The fact that 10% of users use PostHog on mobile despite how bad it works is testament that mobile support is necessary. We shouldn't wait for customer complaints before starting to fix this. :) I'd ideally love to keep the interface as is (drag to move always + resize from corner always) for desktop users who use a mouse with a scroll wheel or a two finger touchpad gesture to scroll the page, yet there is no way to reliably detect this. Browser detection won't work as there will be too many exceptions (e.g. maybe you're using a mac with a touchscreen monitor?). We can detect usage of features (e.g. a lot of "mousemove" or "mousewheel" events to indicate that there is a mouse/touchpad/trackpad), yet I'm fairly confident windows laptops with touchscreens also send them on touch for example (experience building apps with a colleague who used a Thinkpad with a touch screen). On touchscreen windows devices, there's some extra gesture control on Chrome, where touching the screen is normally a click, yet if you touch and drag, it scrolls. That probably breaks down if you touch and drag on an element which listens to mousedown/mousemove/touchstart/etc events. Plus then there are iOS devices that require you to specify explicitly that it's a touchpoint, otherwise your listeners will drag the elements and the page will scroll as well. (We had these issues in pigeon-maps for example). All this is to say that for the best UX between devices, we need to have two modes: dragging enabled and dragging disabled. This "lock dragging mode" switch might be a feature request anyway at some point, as I expect there can be too many accidents if we allow moving things around for everyone. I can imagine frustrated CEOs thinking "why is this dashboard not how I left it" and then opening a ticket. If you exclude 1) the long click functionality on desktop, 2) the problem with having to click a second time to actually drag then and 3) the wiggly effect that might be slow on some devices, that's what this PR does. There's a button to activate the "rearranging mode" here: And five ways to get out of it: 1) clicking the same button again, 2) clicking the "toast" in the bottom, 3) clicking ESC, 4) clicking on the background, 5) clicking the browser back button. The wiggling is just a way to make it clear that you're in "rearranging" mode. If it's slow, we should find some alternative solution. One idea is to only make things wiggle below a certain resolution when we're rather certain it's a phone/tablet.... and to just overlay arrow icons over the panels on higher width screens. The other thing I could do is to make things wiggle only after long pressing with "touchstart" events, excluding "mousedown". The thing is touchstarts also trigger mousedowns, but mousedowns don't trigger touchstarts, so on Android/iOS devices we can detect a long-tap. On windows touchscreen devices (where everything is a mouse) you will only get into the "rearranging" mode then when clicking the button. (Comment out lines 48-51 in useLongPress to try). In any case, please let me know what you think of all of this and what solutions we could consider. It might be worth pooling more opinions as well. |
I've had another play with this this morning
Again, I really appreciate how much effort you put into making this re-arranging work but I guess I've just fallen in love with how this currently works in master. I also think this will be less work than trying to to implement the detection method you talked about in your comment. |
Hey, how about trying something like this?
However, to be fair, I expect that over the life of the product, 99% of the time if you open a dashboard you have no intention to rearrange anything. Making sacrifices for the 99% to serve the 1% feels a bit too much like going into American politics... 😁 |
I think that makes sense! Let's also try the dragging on title bar only, as I think that'll super easily solve the copying-text issue plus might make it easier on mobile too. |
…nly to enable wobbly mode
676c0e7
to
56c8e0e
Compare
Hi @timgl , a new batch of updates is up! I did the following changes now
I think that's it. There's just one thing that still can't be properly done: you can't select text on a touch device, as that will enable wobbly dragging mode. I'm a bit conflicted about it. I could add logic to not enable wobbly mode when you click on selectable text, yet often when I want to enable wobbly mode, I see that I start it by e.g. longpressing on the number in the middle of the pie chart. Also, the idea to always enable the same type of dragging, yet make only the panel headers and edges/corners interactive breaks down quickly when you try to use it on a phone. While only 10-20% of the screen is a "minefield" this way, it's still way to easy to hit a drag target when casually scrolling down. Thus this won't work. |
Hi @timgl , a few more thoughts and a few related changes. I think moving the panels from the title is fine, yet I still somehow want to drag them from wherever on my computer. It's also not really apparent that the header is where you can start dragging from. There's only one indication for that: the mouse cursor turns to the <-> move arrows. So unless you hover over the invisible header boundary, you won't know you can move the panels. Thus I made some changes:
I hope this fixes most of the UX issues we had. Please let me know if there's anything more to do :). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, good point. I reduced that space now by approx 66.6667% on smaller screens. Merging! |
😄 |
Discussion in #752
Changes
Enables better control of panel dragging. Still a work in progress.
Checklist