-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dropdown with "hover" trigger incorrectly rendered on mobile devices #3961
Comments
- Fixes the issue that the contents of a hoverable `BDropdown` was displayed at a wrong position on a mobile (narrow) screen. Cancels the effect of `.is-hoverable` if the screen is narrow. One drawback is that the dropdown won't be displayed on mobile screen unless triggers other than "hover" are enabled. But this should not matter on actual mobile (touch) devices because "hover" won't work on such devices anyway. Another drawback is that if "click" trigger is combined with "hover", the dropdown contents won't be closed by moving the pointer out of the trigger once users click on the trigger. This might confuse the users. issue buefy#3961
- Adds "click" trigger to the dropdown with "hover" trigger in `ExSimple` example of `BDropdown`. This is done to see the effect of the fix for buefy#3961.
@glumb @wesdevpro You can test the new behavior here: https://deploy-preview-3962--buefy-org.netlify.app/ There are two drawbacks:
|
@wesdevpro Hover is suppressed if the screen is narrower than 1024px ( |
- Adds an explanation that "hover" trigger of `BDropdown` is suppressed on a mobile screen, and the hint to change the default behavior. This is intended to answer the following comment: - buefy#3961 (comment)
@wesdevpro I have added a hint: |
In my opinion, making that note in the docs is sufficient enough to prevent downside number 2. Of course, this is assuming developers do not require the "click" trigger to be combined with "hover". |
@wesdevpro I found the explanations contradicting. |
After reading that I agree the docs are contradicting 😅 |
I started to think we should keep the original statement "Dropdowns with hoverable prop won't change its behavior". I will do some experiments around "touchstart" events to detect not only a narrow screen but actual mobile devices. |
- Fixes the issue that `BDropdown` with "hover" trigger changed the behavior depending on the screen width; became modal on a narrow screen. The previous behavior contradicted the statement on the documentation "Dropdowns with "hover" trigger won't change it's behavior". See buefy#3961 (comment) I decided to keep the statement. However, hover events do not make sense on touch devices. So "hover" trigger works like "click" trigger on touch devices, and dropdown contents are shown in a modal. To detect actual touch devices, the trigger element of `BDropdown` now handles touch events: touchstart, touchmove, and touchend. The contents of `BDropdown` with "hover" trigger on a touch device pops up only when the trigger is tapped; i.e., at touchend immediately following touchstart. `BDropdown` bears `.is-touch-enabled` class if the trigger is tapped. Removes the CSS rules that cancels `.is-hoverable` on a narrow screen. The modal style is applied when the screen is narrow and: - `.is-hoverable` is disabled - or `.is-touch-enabled` is enabled "hover" trigger precedes "click" trigger in case both are enabled.
Sound slike a plan! |
@glumb @wesdevpro I have refined the behavior. Now "hover" trigger works differently on touch devices or non-touch devices (e.g., PC):
Please check the behavior here: https://deploy-preview-3962--buefy-org.netlify.app/documentation/dropdown |
…ices (#3961) (#3962) * fix(lib): dislodged hoverable dropdown on mobile screen - Fixes the issue that the contents of a hoverable `BDropdown` was displayed at a wrong position on a mobile (narrow) screen. I initially thought to cancel the effect of `is-hoverable` on narrow screen whether it is on mobile devices or not. But it contradicted to the documentation of `Dropdown`, and I decided to keep the original statement about the behavior of "hover" trigger. #3961 (comment) Since hover events do not make sense on touch devices. "hover" trigger now works like "click" trigger on touch devices, and dropdown contents are shown in a modal when the screen is narrow. To detect actual touch devices, the trigger element of `BDropdown` now handles touch events: touchstart, touchmove, and touchend. The contents of `BDropdown` with "hover" trigger on a touch device pops up only when the trigger is tapped; i.e., at touchend immediately following touchstart. `BDropdown` bears `.is-touch-enabled` class if the trigger is tapped. The modal style is applied when the screen is narrow and: - `.is-hoverable` is disabled - or `.is-touch-enabled` is enabled The `:hover` state is only applied if touch is not enabled (`:not(.is-touch-enabled)`). Delays to reset `isTouchEnabled` to avoid glitches; I observed a ghost of the dropdown menu under the trigger on a touch device. I avoided `@media (hover: hover)` condition for the `:hover` state, because it might cause problems on 2-in-1 devices: #3962 (comment) "hover" trigger precedes "click" trigger in case both are enabled. * feat(docs): dropdown "hover" behavior on touch devices - `ExSimple` example of `BDropdown` explains the new behavior of `BDropdown` with "hover" trigger on touch devices. --------- Co-authored-by: Wesley Ford <[email protected]>
Any ETA when this will be live? :) |
When we publish the next and final release from the Core Team for Buefy V2(maybe this week or next week). See #3874 |
There are also a few working parts we need to get done to prepare to move Buefy-next here |
…ices (#3961) (#3962) * fix(lib): dislodged hoverable dropdown on mobile screen - Fixes the issue that the contents of a hoverable `BDropdown` was displayed at a wrong position on a mobile (narrow) screen. I initially thought to cancel the effect of `is-hoverable` on narrow screen whether it is on mobile devices or not. But it contradicted to the documentation of `Dropdown`, and I decided to keep the original statement about the behavior of "hover" trigger. #3961 (comment) Since hover events do not make sense on touch devices. "hover" trigger now works like "click" trigger on touch devices, and dropdown contents are shown in a modal when the screen is narrow. To detect actual touch devices, the trigger element of `BDropdown` now handles touch events: touchstart, touchmove, and touchend. The contents of `BDropdown` with "hover" trigger on a touch device pops up only when the trigger is tapped; i.e., at touchend immediately following touchstart. `BDropdown` bears `.is-touch-enabled` class if the trigger is tapped. The modal style is applied when the screen is narrow and: - `.is-hoverable` is disabled - or `.is-touch-enabled` is enabled The `:hover` state is only applied if touch is not enabled (`:not(.is-touch-enabled)`). Delays to reset `isTouchEnabled` to avoid glitches; I observed a ghost of the dropdown menu under the trigger on a touch device. I avoided `@media (hover: hover)` condition for the `:hover` state, because it might cause problems on 2-in-1 devices: #3962 (comment) "hover" trigger precedes "click" trigger in case both are enabled. * feat(docs): dropdown "hover" behavior on touch devices - `ExSimple` example of `BDropdown` explains the new behavior of `BDropdown` with "hover" trigger on touch devices. --------- Co-authored-by: Wesley Ford <[email protected]>
…ices (buefy#3961) (buefy#3962) * fix(lib): dislodged hoverable dropdown on mobile screen - Fixes the issue that the contents of a hoverable `BDropdown` was displayed at a wrong position on a mobile (narrow) screen. I initially thought to cancel the effect of `is-hoverable` on narrow screen whether it is on mobile devices or not. But it contradicted to the documentation of `Dropdown`, and I decided to keep the original statement about the behavior of "hover" trigger. buefy#3961 (comment) Since hover events do not make sense on touch devices. "hover" trigger now works like "click" trigger on touch devices, and dropdown contents are shown in a modal when the screen is narrow. To detect actual touch devices, the trigger element of `BDropdown` now handles touch events: touchstart, touchmove, and touchend. The contents of `BDropdown` with "hover" trigger on a touch device pops up only when the trigger is tapped; i.e., at touchend immediately following touchstart. `BDropdown` bears `.is-touch-enabled` class if the trigger is tapped. The modal style is applied when the screen is narrow and: - `.is-hoverable` is disabled - or `.is-touch-enabled` is enabled The `:hover` state is only applied if touch is not enabled (`:not(.is-touch-enabled)`). Delays to reset `isTouchEnabled` to avoid glitches; I observed a ghost of the dropdown menu under the trigger on a touch device. I avoided `@media (hover: hover)` condition for the `:hover` state, because it might cause problems on 2-in-1 devices: buefy#3962 (comment) "hover" trigger precedes "click" trigger in case both are enabled. * feat(docs): dropdown "hover" behavior on touch devices - `ExSimple` example of `BDropdown` explains the new behavior of `BDropdown` with "hover" trigger on touch devices. --------- Co-authored-by: Wesley Ford <[email protected]>
…ices (buefy#3961) (buefy#3962) * fix(lib): dislodged hoverable dropdown on mobile screen - Fixes the issue that the contents of a hoverable `BDropdown` was displayed at a wrong position on a mobile (narrow) screen. I initially thought to cancel the effect of `is-hoverable` on narrow screen whether it is on mobile devices or not. But it contradicted to the documentation of `Dropdown`, and I decided to keep the original statement about the behavior of "hover" trigger. buefy#3961 (comment) Since hover events do not make sense on touch devices. "hover" trigger now works like "click" trigger on touch devices, and dropdown contents are shown in a modal when the screen is narrow. To detect actual touch devices, the trigger element of `BDropdown` now handles touch events: touchstart, touchmove, and touchend. The contents of `BDropdown` with "hover" trigger on a touch device pops up only when the trigger is tapped; i.e., at touchend immediately following touchstart. `BDropdown` bears `.is-touch-enabled` class if the trigger is tapped. The modal style is applied when the screen is narrow and: - `.is-hoverable` is disabled - or `.is-touch-enabled` is enabled The `:hover` state is only applied if touch is not enabled (`:not(.is-touch-enabled)`). Delays to reset `isTouchEnabled` to avoid glitches; I observed a ghost of the dropdown menu under the trigger on a touch device. I avoided `@media (hover: hover)` condition for the `:hover` state, because it might cause problems on 2-in-1 devices: buefy#3962 (comment) "hover" trigger precedes "click" trigger in case both are enabled. * feat(docs): dropdown "hover" behavior on touch devices - `ExSimple` example of `BDropdown` explains the new behavior of `BDropdown` with "hover" trigger on touch devices. --------- Co-authored-by: Wesley Ford <[email protected]>
Overview of the problem
Buefy version: v0.9.27
Vuejs version: 2.7.15
OS/Browser: MacOs/Chrome
Description
The Dropdown does not render correctly in mobile view, when trigger 'hover' is set.
![image](https://private-user-images.githubusercontent.com/3062564/293984941-86aeeaa2-a1de-423a-b4af-b7b8c8b4d488.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTkzMTQyNjksIm5iZiI6MTcxOTMxMzk2OSwicGF0aCI6Ii8zMDYyNTY0LzI5Mzk4NDk0MS04NmFlZWFhMi1hMWRlLTQyM2EtYjRhZi1iN2I4YzhiNGQ0ODgucG5nP1gtQW16LUFsZ29yaXRobT1BV1M0LUhNQUMtU0hBMjU2JlgtQW16LUNyZWRlbnRpYWw9QUtJQVZDT0RZTFNBNTNQUUs0WkElMkYyMDI0MDYyNSUyRnVzLWVhc3QtMSUyRnMzJTJGYXdzNF9yZXF1ZXN0JlgtQW16LURhdGU9MjAyNDA2MjVUMTExMjQ5WiZYLUFtei1FeHBpcmVzPTMwMCZYLUFtei1TaWduYXR1cmU9YzVkY2E3ZjlhMTUzMDAyZGQzMGUwOTliNTkxODhiY2IyMDk3MTIzZTg5NmNkY2EzODY3MTY3NWNmY2U1MjEzYiZYLUFtei1TaWduZWRIZWFkZXJzPWhvc3QmYWN0b3JfaWQ9MCZrZXlfaWQ9MCZyZXBvX2lkPTAifQ.D-OrWUhTQ3SrPZGCTl5CdVAzaKLNiBLwt_OwpDfDsyU)
Steps to reproduce
Expected behavior
Behave like the "Click me!" tiggered button
Actual behavior
The text was updated successfully, but these errors were encountered: