Hacktoberfest 2026: as issues que os mantenedores marcaram para outubro, abertas e boas para iniciantes. Ver issues do Hacktoberfest

TimePicker panel will keep scrolling after select a time.

Aberta
#810 2 comentários 0 reações 0 responsáveis Ver no GitHub

Ninguém assumiu esta issue ainda.

Avaliação

Dificuldade
2/5
Tempo estimado
1-3 horas
Facilidade para iniciantes
45/100
Tipo de issue
Bug
Clareza
Claramente especificada
Status de atividade
Estagnada
Stack de tecnologia
react, typescript
Domínio
frontend

Direção de pesquisa

Comece em useScrollTo.ts e inspecione a condição de término da distância de rolagem descrita na issue. Reproduza o comportamento de TimePicker em um navegador mais antigo, como o Chrome 89, e verifique em seguida se selecionar um horário interrompe a rolagem quando a distância deixa de mudar e se a rolagem com a roda do mouse é acionada normalmente depois disso.

Escrita pelo modelo de indexação a partir do texto da issue.

Descrição

i found the code below in useScrollTo.ts seemed to be buggy. After selecting a time from the time panel, the panel ul will scroll to the target li position. But when the target li is reaching top, the scrolling is not stopped, causing the scroll event could not be triggered on mouse-wheel scrolling.

// Break if dist get larger, which means user is scrolling
if (scrollDistRef.current !== null && scrollDistRef.current < dist) {
  stopScroll();
  return;
}
scrollDistRef.current = dist;

When the scenario above happens, the scrollDistRef.current is always equal to dist. So the stopScroll will be never called.
As I observed, the issue only happened on older browser like Chrome 89 in my case and did not occur on latest Chrome. In the latest Chrome, the scroll event can be fired even if the scrolling is not stopped.
I tried to changed the termimal condition as below, the scrolling is stopped and can be scrolled manually again:

if (scrollDistRef.current !== null && (scrollDistRef.current < dist || Math.abs(scrollDistRef.current - dist) < Number.EPSILON)) {
  stopScroll();
  return;
}

That is, to stop scrolling when scrollDistRef and dist is equal (dist does not change anymore).
Not sure if anyone got the same issue.
The antd version is 5.15.1

Linguagem predominante
TypeScript
Estrelas
304
Forks
349
Merge médio
43min
PRs com merge (30d)
1

Preparar o ambiente

Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.

Primeiros passos

  1. Leia a issue inteira e depois o guia de contribuição do projeto.
  2. Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
  3. Faça um fork do repositório e trabalhe em uma branch.
  4. Abra um pull request que referencie o número da issue.

Mais de react-component/picker

Todas as issues de react-component/picker

Issues semelhantes

Mais issues de TypeScript

Receba novas issues na sua caixa de entrada

Um resumo curto de issues do GitHub para quem está começando.