From 957aef4ff31f5a8056d772ceb2fbd3a0faba029d Mon Sep 17 00:00:00 2001 From: dgtlmoon Date: Wed, 26 Feb 2025 22:23:47 +0100 Subject: [PATCH] UI - Browser Steps - Improving Browser Steps usability on mobile --- changedetectionio/static/js/browser-steps.js | 2 +- .../styles/scss/parts/_browser-steps.scss | 36 +++++++++++------- changedetectionio/static/styles/styles.css | 37 ++++++++++--------- 3 files changed, 43 insertions(+), 32 deletions(-) diff --git a/changedetectionio/static/js/browser-steps.js b/changedetectionio/static/js/browser-steps.js index 5c5fc52a..0b5f17d4 100644 --- a/changedetectionio/static/js/browser-steps.js +++ b/changedetectionio/static/js/browser-steps.js @@ -221,7 +221,7 @@ $(document).ready(function () { // If you switch to "Click X,y" after an element here is setup, it will give the last co-ords anyway //if (x['isClickable'] || x['tagName'].startsWith('h') || x['tagName'] === 'a' || x['tagName'] === 'button' || x['tagtype'] === 'submit' || x['tagtype'] === 'checkbox' || x['tagtype'] === 'radio' || x['tagtype'] === 'li') { $('select', first_available).val('Click element').change(); - $('input[type=text]', first_available).first().val(x['xpath']); + $('input[type=text]', first_available).first().val(x['xpath']).focus();; found_something = true; //} } diff --git a/changedetectionio/static/styles/scss/parts/_browser-steps.scss b/changedetectionio/static/styles/scss/parts/_browser-steps.scss index a5a03de6..2c1dc655 100644 --- a/changedetectionio/static/styles/scss/parts/_browser-steps.scss +++ b/changedetectionio/static/styles/scss/parts/_browser-steps.scss @@ -40,19 +40,22 @@ } } +@media only screen and (min-width: 760px) { -#browser-steps .flex-wrapper { - display: flex; - flex-flow: row; - height: 70vh; - font-size: 80%; - #browser-steps-ui { - flex-grow: 1; /* Allow it to grow and fill the available space */ - flex-shrink: 1; /* Allow it to shrink if needed */ - flex-basis: 0; /* Start with 0 base width so it stretches as much as possible */ - background-color: #eee; - border-radius: 5px; + #browser-steps .flex-wrapper { + display: flex; + flex-flow: row; + height: 70vh; + font-size: 80%; + #browser-steps-ui { + flex-grow: 1; /* Allow it to grow and fill the available space */ + flex-shrink: 1; /* Allow it to shrink if needed */ + flex-basis: 0; /* Start with 0 base width so it stretches as much as possible */ + background-color: #eee; + border-radius: 5px; + + } } #browser-steps-fieldlist { @@ -63,15 +66,21 @@ padding-left: 1rem; overflow-y: scroll; } + + /* this is duplicate :( */ + #browsersteps-selector-wrapper { + height: 100% !important; + } } /* this is duplicate :( */ #browsersteps-selector-wrapper { - height: 100%; + width: 100%; overflow-y: scroll; position: relative; - //width: 100%; + height: 80vh; + > img { position: absolute; max-width: 100%; @@ -91,7 +100,6 @@ left: 50%; top: 50%; transform: translate(-50%, -50%); - margin-left: -40px; z-index: 100; max-width: 350px; text-align: center; diff --git a/changedetectionio/static/styles/styles.css b/changedetectionio/static/styles/styles.css index d49506dc..2e8a6407 100644 --- a/changedetectionio/static/styles/styles.css +++ b/changedetectionio/static/styles/styles.css @@ -46,21 +46,22 @@ #browser_steps li > label { display: none; } -#browser-steps .flex-wrapper { - display: flex; - flex-flow: row; - height: 70vh; - font-size: 80%; } - #browser-steps .flex-wrapper #browser-steps-ui { - flex-grow: 1; - /* Allow it to grow and fill the available space */ - flex-shrink: 1; - /* Allow it to shrink if needed */ - flex-basis: 0; - /* Start with 0 base width so it stretches as much as possible */ - background-color: #eee; - border-radius: 5px; } - #browser-steps .flex-wrapper #browser-steps-fieldlist { +@media only screen and (min-width: 760px) { + #browser-steps .flex-wrapper { + display: flex; + flex-flow: row; + height: 70vh; + font-size: 80%; } + #browser-steps .flex-wrapper #browser-steps-ui { + flex-grow: 1; + /* Allow it to grow and fill the available space */ + flex-shrink: 1; + /* Allow it to shrink if needed */ + flex-basis: 0; + /* Start with 0 base width so it stretches as much as possible */ + background-color: #eee; + border-radius: 5px; } + #browser-steps-fieldlist { flex-grow: 0; /* Don't allow it to grow */ flex-shrink: 0; @@ -71,13 +72,16 @@ /* Set a max width to prevent overflow */ padding-left: 1rem; overflow-y: scroll; } + /* this is duplicate :( */ + #browsersteps-selector-wrapper { + height: 100% !important; } } /* this is duplicate :( */ #browsersteps-selector-wrapper { - height: 100%; width: 100%; overflow-y: scroll; position: relative; + height: 80vh; /* nice tall skinny one */ } #browsersteps-selector-wrapper > img { position: absolute; @@ -92,7 +96,6 @@ left: 50%; top: 50%; transform: translate(-50%, -50%); - margin-left: -40px; z-index: 100; max-width: 350px; text-align: center; }