File tree Expand file tree Collapse file tree 3 files changed +46
-27
lines changed
features/project-settings
packages/design-system/src/components Expand file tree Collapse file tree 3 files changed +46
-27
lines changed Original file line number Diff line number Diff line change @@ -213,8 +213,8 @@ export const SectionMarketplace = () => {
213213
214214 < Grid gap = { 2 } css = { sectionSpacing } >
215215 < Label > Thumbnail</ Label >
216- < Grid flow = "column" gap = { 3 } >
217- < InputErrorsTooltip errors = { errors ?. thumbnailAssetId } >
216+ < InputErrorsTooltip errors = { errors ?. thumbnailAssetId } >
217+ < Grid flow = "column" gap = { 3 } >
218218 < Box className = { thumbnailStyle ( ) } >
219219 < Image
220220 className = { thumbnailImageStyle ( {
@@ -224,18 +224,18 @@ export const SectionMarketplace = () => {
224224 loader = { imageLoader }
225225 />
226226 </ Box >
227- </ InputErrorsTooltip >
228227
229- < Grid gap = { 2 } >
230- < Text color = "subtle" >
231- The optimal dimensions in marketplace are 600x315 px or larger
232- with a 1.91:1 aspect ratio.
233- </ Text >
234- < ImageControl onAssetIdChange = { handleSave ( "thumbnailAssetId" ) } >
235- < Button css = { { justifySelf : "start" } } > Upload</ Button >
236- </ ImageControl >
228+ < Grid gap = { 2 } >
229+ < Text color = "subtle" >
230+ The optimal dimensions in marketplace are 600x315 px or larger
231+ with a 1.91:1 aspect ratio.
232+ </ Text >
233+ < ImageControl onAssetIdChange = { handleSave ( "thumbnailAssetId" ) } >
234+ < Button css = { { justifySelf : "start" } } > Upload</ Button >
235+ </ ImageControl >
236+ </ Grid >
237237 </ Grid >
238- </ Grid >
238+ </ InputErrorsTooltip >
239239 </ Grid >
240240
241241 < Grid gap = { 1 } css = { sectionSpacing } >
Original file line number Diff line number Diff line change @@ -271,6 +271,8 @@ const BindingButton = forwardRef<
271271 left : 0 ,
272272 boxSizing : "border-box" ,
273273 padding : 2 ,
274+ // Because of the InputErrorsTooltip, we need to set zIndex to 1 (as InputErrorsTooltip needs an additional position relative wrapper)
275+ zIndex : 1 ,
274276 transform : "translate(-50%, -50%) scale(1)" ,
275277 transition : "transform 60ms, opacity 0ms 60ms" ,
276278 // https://easings.net/#easeInOutSine
Original file line number Diff line number Diff line change @@ -245,25 +245,42 @@ export const InputErrorsTooltip = ({
245245 // Wrap the error tooltip with its own provider to avoid logic intersection with ordinary tooltips.
246246 // This is especially important for hover delays.
247247 // Here we ensure that hovering over the tooltip trigger after any input will not show the tooltip immediately.
248+ // --
249+ // Additionally, we can't wrap the underlying Input with Tooltip because we are not rendering Tooltips in case of no errors.
250+ // This causes a full re-render of the Input and loss of focus.
251+ // Because of that, we are wrapping the Tooltip with the relative Box component and providing an invisible trigger for the Tooltip.
248252 return (
249253 < TooltipProvider >
250254 < Box ref = { ref as never } css = { { display : "contents" } } > </ Box >
251- < Tooltip
252- { ...rest }
253- collisionBoundary = { collisionBoundary as never }
254- collisionPadding = { - 8 }
255- hideWhenDetached = { true }
256- content = {
257- errors !== undefined && errors . length !== 0
258- ? ( content ?? " " )
259- : undefined
260- }
261- open = { errors !== undefined && errors . length !== 0 }
262- side = { side ?? "right" }
263- css = { css }
264- >
255+ < Box css = { { position : "relative" } } >
256+ < Tooltip
257+ { ...rest }
258+ collisionBoundary = { collisionBoundary as never }
259+ collisionPadding = { - 8 }
260+ hideWhenDetached = { true }
261+ content = {
262+ errors !== undefined && errors . length !== 0
263+ ? ( content ?? " " )
264+ : undefined
265+ }
266+ open = { errors !== undefined && errors . length !== 0 }
267+ side = { side ?? "right" }
268+ css = { css }
269+ >
270+ < Box
271+ css = { {
272+ position : "absolute" ,
273+ inset : 0 ,
274+ visibility : "hidden" ,
275+ // Uncomment for debugging
276+ // backgroundColor: "red",
277+ // opacity: 0.3,
278+ // pointerEvents: "none",
279+ } }
280+ > </ Box >
281+ </ Tooltip >
265282 { children }
266- </ Tooltip >
283+ </ Box >
267284 </ TooltipProvider >
268285 ) ;
269286} ;
You can’t perform that action at this time.
0 commit comments