ui icon indicating copy to clipboard operation
ui copied to clipboard

The focus outline looks not good!

Open hiql opened this issue 2 years ago • 15 comments

🤣 ....could you polish it?

hiql avatar May 23 '23 10:05 hiql

Can you give me an example?

shadcn avatar May 23 '23 15:05 shadcn

not sure if this is what OP is talking about, but this looks weird

CleanShot 2023-05-23 at 23 26 10@2x

and on textarea:

CleanShot 2023-05-23 at 23 26 43@2x

colindotfun avatar May 23 '23 22:05 colindotfun

Looks like a native browser focus outline 🤔

Moshyfawn avatar May 24 '23 04:05 Moshyfawn

yeah it is -- not sure why tho, the official repo template doesn't have it, but if you copy and paste the code it does -- will investigate

colindotfun avatar May 24 '23 12:05 colindotfun

@hiql I was having the same issue... and I was able to fix it by adding these classes to the CommandInput component. <CommandInput className='border-0 focus:ring-0'/>

duvior avatar May 24 '23 20:05 duvior

tried a few different tailwind and global CSS tweaks, but nothing worked reliably

I ended up just reworking my template to build on top of the official template and everything works as expected

colindotfun avatar May 24 '23 21:05 colindotfun

@colinricardo Could you share how you managed to fix the focus outline?

I tried investigating where it comes from in the dev tools, but it's nowhere to be seen...

mariomeissner avatar May 28 '23 07:05 mariomeissner

Ah, I was able to solve it as @duvior described above. Thanks!

mariomeissner avatar May 28 '23 08:05 mariomeissner

Sorry guys, misunderstanding... It's just a personal view

sample

hiql avatar Jun 06 '23 01:06 hiql

I will say, the focus ring on the new york style looks out of place. image I'd recommend something like this: ring-1 ring-inset focus:ring-2 focus:ring-inset [and assorted colors]

Gravy59 avatar Jul 29 '23 16:07 Gravy59

I was experiencing an issue where the outline was getting clipped by parent container. Adding ring-inset helps instead of adding padding in parent container.

Without ring-inset image

With ring-inset image

jsgv avatar Oct 12 '23 21:10 jsgv

Just had this issue and realised I was importing CommandInput from cmdk rather than from Shadcn. This was causing the LHS clipping issue @jsgv notes above.

Import from cmdk Screenshot 2023-10-29 at 12 23 46

Import from /ui/command Screenshot 2023-10-29 at 12 23 03

(ignore bounding boxes on the Button component)

camin-mccluskey avatar Oct 29 '23 12:10 camin-mccluskey

I agree that the UI does not look good. Black shadow displayed when the element is focused. I solved problem as below for select. Hope it helps. <SelectTrigger className="focus:ring-transparent">

NiceDay608088 avatar Dec 26 '23 02:12 NiceDay608088

The most important thing is to understand what it is and why it behaves like this. Please try this "focus:!ring-[#FF8B13]"

Masumraihan avatar Dec 31 '23 05:12 Masumraihan

I use <Textarea placeholder="Type your message here." className="focus:!ring-transparent" /> to make the ring invisible

arealclimber avatar Jan 14 '24 11:01 arealclimber

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jun 30 '24 23:06 shadcn

i noticed i had to use focus:!ring-transparent as AND focus:!border-none

natkins23 avatar Jul 30 '24 05:07 natkins23