Skip to content
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

Dropdown (Tailwind): Focus shadow not working #5512

Closed
sdwillbrand opened this issue Dec 4, 2023 · 9 comments · Fixed by #5519
Closed

Dropdown (Tailwind): Focus shadow not working #5512

sdwillbrand opened this issue Dec 4, 2023 · 9 comments · Fixed by #5519
Assignees
Labels
Component: Tailwind Tailwind specific issue
Milestone

Comments

@sdwillbrand
Copy link
Contributor

Describe the bug

The dropdown does not show a shadow when focused.

Reproducer

https://codesandbox.io/p/sandbox/frosty-hoover-ttd938

PrimeReact version

10.2.1

React version

18.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

  1. Create Dropdown
  2. Focus Dropdown

Expected behavior

The dropdown should have a shadow

@sdwillbrand sdwillbrand added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Dec 4, 2023
@melloware
Copy link
Member

Not sure what you mean by Shadow? @Dalorzo

@melloware melloware added Component: Tailwind Tailwind specific issue and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Dec 4, 2023
@Dalorzo
Copy link
Contributor

Dalorzo commented Dec 4, 2023

@melloware taking a look at this moment, will revert in a bit

@Dalorzo
Copy link
Contributor

Dalorzo commented Dec 4, 2023

@countersoda can you please elaborate why the dropdown should have a shadow? Is this because of a dark mode?

@Dalorzo
Copy link
Contributor

Dalorzo commented Dec 4, 2023

@melloware I found what I think could be the issue:

From docs, I can update the input area, however, any styling applied to input does not get reflected while using the dropdown, more specifically or problematic focus, hover, active.

The styles are set to the input correctly, those are just not visible to user,

<Dropdown
          options={items}
          value={value}
          pt={{
            input: {
              className: "bg-blue-50 focus:bg-blue-900  active:bg-blue-700",
            },
          }}
          onChange={(e) => setValue(e.value)}
        />

image

@sdwillbrand
Copy link
Contributor Author

Bildschirmfoto 2023-12-04 um 15 55 21

As you can see the dropdown is focused. The style focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] should apply to the dropdown, but it is not. I thought a shadow appears around the dropdown when an item is being selected.

@melloware
Copy link
Member

@Dalorzo when I compare to AutoComplete input element its different than what Dropdown input is doing this is what AutoCompelte has.

        input: ({ props }) => ({
            root: {
                className: classNames(
                    'm-0',
                    'transition-colors duration-200 appearance-none rounded-lg',
                    { 'rounded-tr-none rounded-br-none': props.dropdown },
                    {
                        'font-sans text-base text-gray-700 dark:text-white/80 bg-white dark:bg-gray-900 p-3 border border-gray-300 dark:border-blue-900/40 focus:outline-offset-0 focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] dark:focus:shadow-[0_0_0_0.2rem_rgba(147,197,253,0.5)] hover:border-blue-500 focus:outline-none':
                            !props.multiple,
                        'font-sans text-base text-gray-700 dark:text-white/80 border-0 outline-none bg-transparent m-0 p-0 shadow-none rounded-none w-full': props.multiple
                    }
                )
            }
        }),

@Dalorzo
Copy link
Contributor

Dalorzo commented Dec 4, 2023

Bildschirmfoto 2023-12-04 um 15 55 21

As you can see the dropdown is focused. The style focus:shadow-[0_0_0_0.2rem_rgba(191,219,254,1)] should apply to the dropdown, but it is not. I thought a shadow appears around the dropdown when an item is being selected.

@countersoda I think you are correct, I was able to workaround the issue of the data-pc-section="input" by adding the attribute tabindex="0". However, I am not sure what the right solution is, I will defer to @melloware

@melloware
Copy link
Member

I see if you do this even with tabIndex="-1" you can see it.

        <Dropdown
          options={items}
          value={value}
          onChange={(e) => setValue(e.value)}
          pt={{
            input: {
              className: "bg-blue-50 focus:bg-blue-900 active:bg-blue-700",
              tabIndex: "-1",
            },
          }}
        />

melloware added a commit to melloware/primereact that referenced this issue Dec 4, 2023
@melloware melloware self-assigned this Dec 4, 2023
@melloware melloware added this to the 10.2.2 milestone Dec 4, 2023
@melloware melloware assigned Dalorzo and unassigned melloware Dec 4, 2023
melloware added a commit to melloware/primereact that referenced this issue Dec 4, 2023
@melloware
Copy link
Member

@Dalorzo where did we end up on this?

melloware added a commit to melloware/primereact that referenced this issue Jan 9, 2024
melloware added a commit that referenced this issue Jan 9, 2024
* Fix #5485: Messages restore close animation

* Fix #5490: useDebounce fixed

* Fix #5492: Listbox passthrough fixes

* Fix #5493: Multiselect passthrough fixes

* Fix #5485: Messages restore close animation

* Fix #5499: Autocomplete/Chips PT fixes

* Fix #5479: CascadeSelect PT fixes

* Fix #5509: Button loadingIcon Tailwind fix

* Fix #5512: Dropdown add tabindex for Tailwind

* Support roundingMode for InputNumber

* Fix #5523: BlockUI return activeElement focus

* Fix #5530: Chip onRemove event pass value

* DataTable:converted to data- lookups instead of className lookups

* Fix #5543: OverlayPanel Tailwind close icon

* Fix #5546: prop type error in console

* Fix #5555: BodyCell frozen issue

* Fix #5561: Inplace respect active prop

* Fix #5568: MultiSelect filterInput PT

* Fix #5572: Multselect selectAllLabel was being added to DOM

* Tooltip fix Tailwind CSS

* Dialog Breakpoints

* Calendar disabled date handling

* Fix #5609: ToggleButton focusedState

* Fix #5610: Radio/Checkbox always fire onClick

* fix: #5613, TreeSelect: TreeSelect component is not supporting tooltips and is an issue in multiple select mode

* Fix #5623 - Otherprops not working for InputSwitch

* fix:Calendar not showing correctly in Table

* fix:Image preview zoom in bug

* Fix #5637: Sidebar aria-label close

* Accept array as PT value

* Datatable breakpoints

* fix:ConfirmDialog: acceptButton's pt don't respect button
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Tailwind Tailwind specific issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants