-
Notifications
You must be signed in to change notification settings - Fork 22
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
#5078: support showing panel as popover #5023
Conversation
Clear existing popovers Vendor hover intent; smooth out popover Namespace tooltips container
3d4c083
to
977b33f
Compare
Codecov Report
@@ Coverage Diff @@
## main #5023 +/- ##
==========================================
- Coverage 60.54% 60.47% -0.08%
==========================================
Files 962 964 +2
Lines 29223 29316 +93
Branches 5608 5625 +17
==========================================
+ Hits 17694 17728 +34
- Misses 11529 11588 +59
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
@@ -0,0 +1,208 @@ | |||
/*! |
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.
Vendored from http://briancherne.github.io/jquery-hoverIntent/ for module support
@@ -90,12 +90,6 @@ export class Registry< | |||
} | |||
|
|||
private notifyAll() { | |||
console.debug( |
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.
This logging is super noisy
@@ -89,65 +98,101 @@ class DisplayTemporaryInfo extends Transformer { | |||
title, | |||
body: bodyPipeline, | |||
location = "panel", | |||
isRootAware = false, |
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.
Safe default
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.
Why is the brick isRootAware()
"safe default" true
, but the transform()
input param one is false
?
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.
See this PR for more details on the approach: #4910
The idea is that:
- isRootAware is overridden so the runtime sees the brick as root aware
- The brick exposes an isRootAware param, but it defaults to false in calls for backward compatability. It controls whether the brick actually considers the root or not in brick execution
- In the JSONSchema, isRootAware defaults to "true", so new calls create in the Page Editor pass true
- The Brick Configuration looks at the arg to determine which fields to show
default: "panel", | ||
description: "The location of the information (default='panel')", | ||
}, | ||
...IS_ROOT_AWARE_BRICK_PROPS, |
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.
Taking same approach as other PR for upgrading the brick to be root aware
target | ||
)) as PanelPayload; | ||
|
||
switch (location) { |
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.
Switch to a "switch" statement. The whitespace in the diff is bad
Can this be implemented with a shadowdom instead of iframe? It contains style and the JS still lives in the content script context, similarly to how the QuickBar and notifications work |
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.
Just a few nits and minor questions, code seems good overall though 👍
I didn't check out the branch and do any local QA on the UX for this though.
@@ -89,65 +98,101 @@ class DisplayTemporaryInfo extends Transformer { | |||
title, | |||
body: bodyPipeline, | |||
location = "panel", | |||
isRootAware = false, |
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.
Why is the brick isRootAware()
"safe default" true
, but the transform()
input param one is false
?
const [entry, isLoading, error] = useAsyncState( | ||
async () => getPanelDefinition(target, nonce), | ||
[nonce] | ||
); | ||
|
||
useEffect(() => { | ||
document.dispatchEvent( | ||
new CustomEvent("@@pixiebrix/PANEL_MOUNTED", { detail: nonce }) |
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.
Should probably put this event name in a constant in constants.ts
with our other custom events there
@@ -123,7 +148,7 @@ export async function resolveTemporaryPanel(nonce: UUID, action: PanelAction) { | |||
* Cancel some temporary panels' deferred promises | |||
* @param nonces The nonces of the panels to reject with a CancelError | |||
*/ | |||
export async function cancelTemporaryPanels(nonces: UUID[]) { | |||
export async function cancelTemporaryPanels(nonces: UUID[]): Promise<void> { |
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.
nit: Make this a varargs param so we don't have to create arrays at all the call sites.
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.
I prefer not to unless we're sure that we won't want to add an optional options arg on later. Personally, I'm not a big fan of var args for lists of things
// `hoverIntent` JQuery plugin has custom event names | ||
$elements.off("mouseenter.hoverIntent"); | ||
$elements.off("mouseleave.hoverIntent"); | ||
$elements.hoverIntent({ |
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.
Just checking, do we want to pass in a timeout
delay here to hoverIntent
options? Just want to make sure that calling the handler instantly on mouse out event is fine here for the UX on the popovers.
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.
It's OK to call instantly, since the event has already fired at that point. There's no notion of a "hover end" trigger. We're really only using the hoverIntent for the "hover start"
@@ -120,6 +120,7 @@ const TriggerConfiguration: React.FC<{ | |||
<option value="dblclick">Double Click</option> | |||
<option value="blur">Blur</option> | |||
<option value="mouseover">Mouseover</option> | |||
<option value="hover">Hover</option> |
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.
Are users going to be confused about the difference between Mouseover
and Hover
here?
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.
Are users going to be confused about the difference between Mouseover and Hover here?
Probably? We'll need to clean up all out trigger names to better clarify what they are. E.g., most users won't have a way of knowing what "blur" means
When the PR is merged, the first loom link found on this PR will be posted to |
Sadly I don't think - we run into the same issue we do with forms. We want to isolate the content completely from the CSS (because out document builder uses bootstrap). And certain things like root font-size REM aren't isolated by the shadow dom In the future, we might be able to get away with it by doing a custom build of bootstrap for forms/panels with CSS rules that can't be effected by any of the CSS props that leak into the shadow root |
Ah yes it's a |
What does this PR do?
Known Issues
Improve placement of "x": N/A.Using click outside event insteadDemo
Future Work
Checklist