GoogleChromeLabs / ProjectVisBug

FireBug for designers › Edit any webpage, in any state https://a.nerdy.dev/gimme-visbug
https://visbug.web.app
Apache License 2.0
5.41k stars 284 forks source link

Stay inside viewport #159 #530

Closed hchiam closed 2 years ago

hchiam commented 3 years ago

For #159, as per one of the suggestions in pr #528

WIP, to look into:

screenshot

I had to refactor to work with <visbug-labels>, which can't directly access their respective parent/container elements since they're direct descendants of the body

argyleink commented 3 years ago

played around with your WIP featureset here for the past couple days, there's some cool thinking in it! i'm curious if css sticky would work somehow or if maybe these labels with arrows only show up as additional labels instead of trying to be both the inline and out of view label?

they got really crowded and stacked too when making a big selection and some other small stuff, but i'm sure you're aware of them in this WIP pr 👍🏻

but i like the goal, which i'm understanding as hint to where the label is. it does feel tho like #159 is getting a little left behind as this new hint feature is absorbing lots of the work effort. all in all, seems like a worthy ux exploration. hope it's been fun!

hchiam commented 2 years ago

not sure what happened, but when i ran npm ci; npm run extension:build; npm run test:ci locally, all tests passed even without the last fix

hchiam commented 2 years ago

Ready for review again! 😃 Just a max of 8 overflow labels (8 cardinal directions), with counts:

Screen Shot 2021-07-23 at 9 10 21 PMScreen Shot 2021-07-23 at 9 10 43 PM Screen Shot 2021-07-23 at 9 10 54 PM (overflow labels disappear if they have count === 0)

v2

argyleink commented 2 years ago

there's a ton of really great work and ux in here! excited to see it evolve 🙂 most certainly valuable to know that elements are selected out of the viewport.

ux requests / bugs:

I wonder if we can simplify things a bit and only show up, down, left and right? or help me understand the corners and the reasoning you had when building the ux?!

thanks for the update, had a blast testing this out!

hchiam commented 2 years ago

Thanks! If i understand correctly, here are your thoughts + my thoughts, to-do-list-ified so it's easier for me to keep track:

3 here 5 things overflowing/offscreen here
29 things overflowing/offscreen here

Technically it should be true overflow, not simply offscreen stuff ( see 3) ).

hchiam commented 2 years ago

Updated the TODO list above. Addressed most things hopefully.

The tl;dr: this PR currently creates overflow labels that track all the <visbug-label>s added to the DOM by VisBug (when you /zindex, search, etc.).

For 2), @argyleink, let me know if it still makes sense to go ahead with making these overflow labels show up all the time. I think the drawback is we'd always be watching all elements to check if they're overflowing (perf), instead of only watching all VisBug labels to check if they're overflowing.

Besides that, the only other thing for me to look into is to fix the count logic, if you happen to re-run the same search or re-run /zindex ("5)b" in the TODO list). overflowLabel.element.js count

argyleink commented 2 years ago

nice! lots of great improvements here 🙂

2) i'm thinking this is nice =) did you run into any performance issues from it, it seems to work great for me. 5b) imo this is out of your control as plugins cause side effects on a page, a user running /zindex multiple times is going to get the side effects repeated. but, it does expose how some of the logic works, like implementation details leaking into the front end. but i dunno, seems like a small issue to me, we can track it but it's low priority imo.

Remaining items:

Cool, this is super helpful for multi-select when there's many elements selected across a big page 💯 cool feature addition! thanks for hackin on it 👍🏻

hchiam commented 2 years ago

thanks Adam! i found this to be an interesting feature to think about

agreed, the count logic fix is low prio.

I've now filtered out the labels on the body so the offscreen logic ignores them, but you'll probably see another label show up for main on the test site. You can now hover over the "offscreen" labels to see the text of one of the labels hidden in that direction.

And sorry, it's been a while and i see i misunderstood 2) and thought we're handling overflow. I recall now that this PR is just handling offscreen labels (https://github.com/GoogleChromeLabs/ProjectVisBug/pull/528#discussion_r659899655). The performance LGTM as-is.