From 7616b07f8e263520cd346d31e2d47374ff8a8780 Mon Sep 17 00:00:00 2001 From: Conduitry Date: Fri, 16 Sep 2022 12:25:36 -0400 Subject: [PATCH] remove workaround for missing event.relatedTarget --- validator.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/validator.js b/validator.js index 97be409..1085fa4 100644 --- a/validator.js +++ b/validator.js @@ -31,10 +31,9 @@ export const validator = (chill) => { // so we first create the function, and then assign methods onto it const action = (node) => { // trigger validation whenever focus goes from inside our node to outside our node - const on_blur = async (event) => { + const on_blur = (event) => { // if validation messages aren't already enabled, check whether the new focused element is outside of our node - // if event.relatedTarget is not available, wait 100ms and then use document.activeElement - if (!message_enabled && !node.contains(event.relatedTarget || (await new Promise((res) => setTimeout(() => res(document.activeElement), 100))))) { + if (!message_enabled && !node.contains(event.relatedTarget)) { // enable displaying validation messages for this validator, and update the store validate(); }