Skip to content

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

Open
@yangwooseong

Description

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

Preview Give feedback

References

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    enhancementIssues or PR related to making existing features bettergood first issueIssue that good for newcomers

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions