본문 바로가기

개발일지

SweetAlert 사용시 포커스 에러

SweetAlert 사용시 포커스 에러

Blocked aria-hidden on a <input> element because the element that just received focus must not be hidden from assistive technology users. Avoid using aria-hidden on a focused element or its ancestor. Consider using the inert attribute instead, which will also prevent focus. For more details, see the aria-hidden section of the WAI-ARIA specification at https://w3c.github.io/aria/#aria-hidden.

 

Accessible Rich Internet Applications (WAI-ARIA) 1.3

A section of a page that consists of a composition that forms an independent part of a document, page, or site. An article is not a navigational landmark, but can be nested to form a discussion where assistive technologies could pay attention to article ne

w3c.github.io

 

// 기존
Swal.fire({ 
	icon: "warning", 
    text: "주행거리 소수점이하는 제외해주세요." 
}).then(()=>{
    $("#RUN_KM").focus();
});

// 변경

Swal.fire({ 
    icon: "warning", 
    text: "주행거리를 입력하세요.", 
    allowOutsideClick: true, 
    didClose: () => {
	        $("#RUN_KM").focus(); // 모달이 완전히 닫힌 후 포커스 이동
	}
});

 

 

쨋쥐피티 결과