[#181] disable popovers on mobile UI on init and resizing events

This commit is contained in:
Robin Scholtes 2023-04-24 11:32:34 +12:00
parent a252c34968
commit 4a761673c0
6 changed files with 42 additions and 9 deletions

View file

@ -214,6 +214,7 @@ module.exports = function (grunt) {
}, },
devServer: { devServer: {
port: grunt.option("port") || 8080, port: grunt.option("port") || 8080,
host: "0.0.0.0",
client: { client: {
logging: "error", logging: "error",
overlay: true overlay: true

View file

@ -878,6 +878,29 @@ class App {
} }
} }
} }
/**
* Aggregate all the desktop UI functions.
*
* Popovers and desktop layout are set on init, but we also need to
* update the UI correctly on window resizing events
*/
setDesktopUI(minimise){
this.setDesktopLayout(minimise);
this.manager.ops.enableOpsListPopovers();
}
/**
* Aggregate all the mobile UI functions.
*
* Popovers and desktop layout are set on init, but we also need to
* update the UI correctly on window resizing events
*/
setMobileUI(){
this.setMobileLayout();
this.manager.ops.disableOpsListPopovers();
}
} }
export default App; export default App;

View file

@ -4,8 +4,6 @@
--- ---
#### Mobile UI ( on real device ): #### Mobile UI ( on real device ):
- disableOpsListPopover() on window resize event, not working 10/10 yet for modal op-lists
- on mobile UI, there is almost no visual feedback when adding an operation to the recipe list. Since the recipe list is not visible like on desktop, this is very confusing UX - on mobile UI, there is almost no visual feedback when adding an operation to the recipe list. Since the recipe list is not visible like on desktop, this is very confusing UX
- adding an operation only works with drag and drop, not on double tap or the like. This todo is related to the remaining mobile UI one. - adding an operation only works with drag and drop, not on double tap or the like. This todo is related to the remaining mobile UI one.
Dragging and dropping won't be an option on mobile, because then you can't scroll the operations list. I'm thinking to add Dragging and dropping won't be an option on mobile, because then you can't scroll the operations list. I'm thinking to add
@ -17,6 +15,8 @@
- test drag and drop etc. Regular mobile events / UX - test drag and drop etc. Regular mobile events / UX
- view-heights not correct due to variable taskbar on mobile devices - view-heights not correct due to variable taskbar on mobile devices
- minor issue w popovers glitching in modal ( edit favourites ), but it only occurs on (laptop) browser < breakpoint, not on a real mobile device. It's minor but bothers me
### Desktop UI: ### Desktop UI:
### General UI: ### General UI:
- fix up key / tab events so UI can be navigated comfortably with keys ( inc. visual focus feedback ). Probably a lot of work though - fix up key / tab events so UI can be navigated comfortably with keys ( inc. visual focus feedback ). Probably a lot of work though
@ -25,6 +25,7 @@
- `core/Recipe.mjs`, `core/lib/Magic.js` return imports to original - `core/Recipe.mjs`, `core/lib/Magic.js` return imports to original
### Misc: ### Misc:
- Gruntfile revert dev config
- comb through CSS and improve organisation for better DevX. Ask repo owners to open another issue perhaps and just redo all of the stylesheets ( preferably with SASS ) - comb through CSS and improve organisation for better DevX. Ask repo owners to open another issue perhaps and just redo all of the stylesheets ( preferably with SASS )
- delete this file when done :) - delete this file when done :)

View file

@ -185,18 +185,18 @@ class OperationsWaiter {
if ( window.innerWidth < this.app.breakpoint ){ if ( window.innerWidth < this.app.breakpoint ){
this.disableOpsListPopovers(); this.disableOpsListPopovers();
} else { } else {
this.enableOpsListPopovers(e.target); this.enableOpPopover(e.target);
} }
} }
/** /**
* Sets up popovers, allowing the popover itself to gain focus which enables scrolling * Enable the target operation popover itself to gain focus which
* and other interactions. * enables scrolling and other interactions.
* *
* @param {Element} el - The element to start selecting from * @param {Element} el - The element to start selecting from
*/ */
enableOpsListPopovers(el) { enableOpPopover(el) {
$(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]") $(el).find("[data-toggle=popover]").addBack("[data-toggle=popover]")
.popover({trigger: "manual"}) .popover({trigger: "manual"})
.on("mouseenter", function(e) { .on("mouseenter", function(e) {
@ -218,6 +218,7 @@ class OperationsWaiter {
}); });
} }
/** /**
* Disable popovers on all op-list list items * Disable popovers on all op-list list items
*/ */
@ -225,6 +226,13 @@ class OperationsWaiter {
$(document.querySelectorAll(".op-list .operation")).popover("disable"); $(document.querySelectorAll(".op-list .operation")).popover("disable");
} }
/**
* Enable popovers on all op-list list items
*/
enableOpsListPopovers(){
$(document.querySelectorAll(".op-list .operation")).popover("enable");
}
/** /**
* Handler for operation doubleclick events. * Handler for operation doubleclick events.

View file

@ -139,7 +139,7 @@ class RecipeWaiter {
enableOpsElement = evt.item; enableOpsElement = evt.item;
$(evt.item).attr("data-toggle", "popover"); $(evt.item).attr("data-toggle", "popover");
} }
this.manager.ops.enableOpsListPopovers(enableOpsElement); this.manager.ops.enableOpPopover(enableOpsElement);
if (evt.item.parentNode.id !== "rec-list") { if (evt.item.parentNode.id !== "rec-list") {
return; return;

View file

@ -30,9 +30,9 @@ class WindowWaiter {
debounce(this.app.adjustComponentSizes, 200, "windowResize", this.app, [])(); debounce(this.app.adjustComponentSizes, 200, "windowResize", this.app, [])();
if ( window.innerWidth >= this.app.breakpoint ) { if ( window.innerWidth >= this.app.breakpoint ) {
this.app.setDesktopLayout(false); this.app.setDesktopUI(false);
} else { } else {
this.app.setMobileLayout(); this.app.setMobileUI();
} }
} }