반응형

Uncaught Error: input is a void element tag and must neither have `children` nor use `dangerouslySetInnerHTML`.

반응형
반응형

input요소에 포커스가 가지 않고 copy & paste방지한것처럼 select가 되지 않는 버그 때문에 찾아보니

pointer-event:none 을 해주면 그렇게 된다고 한다

그러나 이때문은 아니고 syncfusion state 변경후 re-render될때 뭔가 안맞아서 그런것으로 예상됨

재현조건을 좁혀봤더니 dropdownList에서 state변경을 통해 구현한 부분에서 정확히 에러가 발생하는 것으로 추정되었기 때문

반응형
반응형
반응형
반응형

html파일에서 <!DOCTYPE html>을 써주지 않아 html의 최신 버전을 알려주지 않거나,

user agent stylesheet에서 명시하는 속성을, 내가 직접 override하지 않으면 그 기본 규칙이 적용될 수 있다.

 

이를 미연에 방지하는 법은, 브라우저의 모든 기본 CSS 규칙을 초기화하기 위해

CSS Reset (meyerweb.com/eric/tools/css/reset/)을 해주는 것이 있겠다.

반응형
반응형
반응형
반응형
반응형
반응형
반응형
반응형

기본: element.focus(), <input autofocus/> autoFocus아님

react 간단버전: <input ref = { input =>  input && input.focus() } />

react

import React, { useEffect, useRef } from 'react';

export default function MyComponent(): JSX.Element {
    const inputReference = useRef<HTMLInputElement>(null);

    useEffect(() => {
        inputReference.current?.focus();
    }, []);

    return (
        <div>
            <input ref={inputReference} />
        </div>
    );
}

react useFocus hook 버전

const FocusDemo = () => {
    const [inputRef, setInputFocus] = useFocus()

    return (
        <> 
            <button onClick={setInputFocus} >
               Focus
            </button>
            <input ref={inputRef} />
        </>
    )
}

const useFocus = () => {
    const htmlElRef = useRef(null)
    const setFocus = () => {htmlElRef.current &&  htmlElRef.current.focus()}

    return [ htmlElRef, setFocus ] 
}

 

<input ref={input => input && input.focus()}/>

반응형
반응형

center vertially

  • using padding
  • using line-height
    • line-height: text의 높이, 1이면 text의 1배, 즉 높이 = text높이, 그래서 다음라인과의 간격이없어짐
    • 1.5이면 text의 1.5배니까 위아래로 0.5배만큼의 간격이 생김
    • 폰트마다 text크기가 다르기때문에 px로 지정하면 위험하고 1, 0.9 이렇게 비율로 지정해야함
    • block안에 inline/inline-block이 있으면 그것도 전체적으로 text로 취급되어 block에 설정된 line-height의 지배를 받음, 참고예제) https://www.w3schools.com/css/tryit.asp?filename=trycss_align_line-height
  • using position & transform
  • using flexbox

 

 

line-height가 무엇인지 알려면 참고할것https://m.blog.naver.com/weekamp/222040583269

 

CSS - line-height 총 정리

line-height속성 이 속성에 절대값으로 px을 주면 안된다. 왜냐면, 그 태그의 텍스트 사이즈가 변경되었을...

blog.naver.com

 

 

 

https://www.w3schools.com/css/css_align.asp

반응형
반응형
반응형

+ Recent posts