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

[BUG] - Select component scrolled through page #3265

Closed
uigywnkiub opened this issue Jun 16, 2024 · 7 comments · Fixed by #3414
Closed

[BUG] - Select component scrolled through page #3265

uigywnkiub opened this issue Jun 16, 2024 · 7 comments · Fixed by #3414
Assignees
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working

Comments

@uigywnkiub
Copy link

NextUI Version

2.4.2

Describe the bug

Select component scrolled through page. (It's my NDA pet-project, do not use anything for you about it)

Your Example Website or App

No response

Steps to Reproduce the Bug or Issue

When click of Select it's became floating card

Expected behavior

Select menu must be stricted on his place

Screenshots or Videos

Screen.Recording.2024-06-16.at.18.09.18.mov

Operating System Version

  • OS: macOS

Browser

Chrome

Copy link

linear bot commented Jun 16, 2024

@wingkwong
Copy link
Member

I couldn't reproduce this issue on our doc page. Please share a minimal reproducible project for us to investigate.

@uigywnkiub
Copy link
Author

I couldn't reproduce this issue on our doc page. Please share a minimal reproducible project for us to investigate.

I record a screen video to showing the bug, on previous version of nexutui all being good. It's my pet project, without any custom logic, on Select component.

image

@wingkwong
Copy link
Member

Is your select component inside a modal?

@uigywnkiub
Copy link
Author

Is your select component inside a modal?

I'm sorry but no)

  return (
    <Accordion
      isCompact
      hideIndicator
      onExpandedChange={onExpandedChangeCallback}
    >
      <AccordionItem
        key='1'
        isCompact
        aria-label={isExpanded ? 'Hide Form' : 'Show Form'}
        title={isExpanded ? 'Hide Form' : 'Show Form'}
        classNames={{
          title: 'text-center hover:opacity-hover',
        }}
      >
        <form
          className='mx-auto'
          action={createTransactionWithUserId}
          onSubmit={onSubmitCallback}
        >
          <Switch
            color='success'
            name='isIncome'
            value='isIncome'
            aria-label='Income Switch'
            onValueChange={onSwitchChangeCallback}
          >
            Income
          </Switch>
          <Input
            type='text'
            name='description'
            aria-label='Description'
            required
            size='lg'
            color={isSwitchedOn ? 'success' : 'danger'}
            placeholder={
              isSwitchedOn
                ? 'Type income transaction...'
                : 'Type expense transaction...'
            }
            classNames={{
              input: 'border-none focus:ring-0 placeholder:text-default-500',
              inputWrapper: 'h-20 my-2',
            }}
            endContent={
              <Input
                type='text'
                name='amount'
                aria-label='Amount'
                required
                maxLength={6}
                pattern='\d+'
                inputMode='decimal'
                placeholder='0'
                size='lg'
                classNames={{
                  input:
                    'border-none focus:ring-0 placeholder:text-default-500 text-center',
                  inputWrapper: 'h-12 w-full',
                  base: 'w-36',
                }}
                endContent={
                  <div className='pointer-events-none flex items-center'>
                    <span className='text-md text-lg text-default-500'>
                      {CURRENCY_SIGN}
                    </span>
                  </div>
                }
              />
            }
          />
          <div className='flex justify-between'>
            <div className='flex items-center gap-2'>
              <div className='flex w-full flex-wrap gap-4 md:flex-nowrap'>
                <Select
                  name='category'
                  aria-label='Category'
                  className='w-52'
                  defaultSelectedKeys={[DEFAULT_CATEGORY]}
                >
                  {categories.map((category, idx, arr) => (
                    <SelectSection
                      key={category.target}
                      showDivider={idx !== arr.length - 1}
                      title={category.target}
                    >
                      {category.items.map((item) => (
                        <SelectItem key={item.name}>
                          {`${item.emoji} ${item.name}`}
                        </SelectItem>
                      ))}
                    </SelectSection>
                  ))}
                </Select>
              </div>
            </div>
            <div className='flex items-center'>
              <p className='text-sm text-default-500'>
                Press{' '}
                <button
                  aria-label='Enter'
                  type='submit'
                  className='cursor-pointer'
                >
                  <Kbd keys={['enter']}>Enter</Kbd>
                </button>{' '}
                to Add Transaction
              </p>
            </div>
          </div>
        </form>
      </AccordionItem>
    </Accordion>
  )

@winchesHe
Copy link
Member

winchesHe commented Jul 1, 2024

@uigywnkiub I have tried in dev enviroment, and I couldn't reproduce this issue, could you provider a minimal reproducible project or a reproducible codesandbox for us to investigate

CleanShot.2024-07-01.at.22.47.19.mp4

@winchesHe
Copy link
Member

@uigywnkiub I have reproduced this issue, it was a usage issus, cause current popover is using absolute to locate in page, therefore if you put the select in scrolling container, and scroll the container not the page it will cause this issue

CleanShot.2024-07-01.at.23.03.58.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
📦 Scope : Components Related to the components 🐛 Type: Bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants