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

Remove unnecessary ClientRect from return type of TextFieldRef.getBoundingClientRect #1686

Open
1 task
yangwooseong opened this issue Oct 19, 2023 · 0 comments
Labels
enhancement Issues or PR related to making existing features better good first issue Issue that good for newcomers

Comments

@yangwooseong
Copy link
Collaborator

yangwooseong commented Oct 19, 2023

Summary

TextFieldRef.getBoundingClientRect 의 return type 에 deprecated 된 ClientRect 타입을 제거합니다. ClientRectDOMRect 를 extends 할 뿐 추가로 다른 속성을 가지지는 않기 때문에 제거해도 무방합니다.

export interface TextFieldRef {
  focus(options?: FocusOptions): void
  blur(): void
  setSelectionRange(start?: number, end?: number, direction?: SelectionRangeDirections): void
  getSelectionRange(): [number, number]
  selectAll(): void
  unselect(): void
  getBoundingClientRect(): ClientRect | DOMRect // ClientRect just extends DOMRect and is deprecated
  getDOMNode(): HTMLInputElement | null
}

Description

getBoundingClientRect(): ClientRect | DOMRect 를 가지고 있는 것 때문에 HTMLElement, TextFieldRef 를 확장한 인터페이스를 만들지 못하는 문제가 있습니다.

image

Todo

근본적으로는 TextField 안에서 useImperativeHandle을 사용하여 HTMLInputElement 에 대한 정보를 모두 잃어버리게 되고, RefObject<HTMLElement> 타입의 값을 TextField 의 ref 에 할당하지 못하는 것이 문제입니다. useImperativeHandle훅으로
TextField의 ref 타입을 재정의 하고 있는 로직을 지우고 HTMLInputElement 의 속성으로 대체 가능한지 봐야합니다. 작업하게 되면 별도 이슈로 관리하면 좋을 것 같습니다.

Tasks

References

@yangwooseong yangwooseong added enhancement Issues or PR related to making existing features better good first issue Issue that good for newcomers labels Oct 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Issues or PR related to making existing features better good first issue Issue that good for newcomers
Projects
Status: 📌 Backlog
Development

No branches or pull requests

1 participant