Skip to content

Commit

Permalink
refactor: cool dude comment
Browse files Browse the repository at this point in the history
  • Loading branch information
mfranzke committed Jul 26, 2024
1 parent e024f31 commit 6854aad
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 80 deletions.
22 changes: 9 additions & 13 deletions packages/components/src/components/checkbox/checkbox.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
_invalidMessageId: this._id + DEFAULT_INVALID_MESSAGE_ID_SUFFIX,
_descByIds: '',
_voiceOverFallback: '',
handleChange: (event: ChangeEvent<HTMLInputElement>) => {
handleChange: (event: ChangeEvent) => {
if (props.onChange) {
props.onChange(event);
}
Expand Down Expand Up @@ -68,7 +68,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
state._descByIds = '';
}
},
handleBlur: (event: InteractionEvent<HTMLInputElement>) => {
handleBlur: (event: InteractionEvent) => {
if (props.onBlur) {
props.onBlur(event);
}
Expand All @@ -77,7 +77,7 @@ export default function DBCheckbox(props: DBCheckboxProps) {
props.blur(event);
}
},
handleFocus: (event: InteractionEvent<HTMLInputElement>) => {
handleFocus: (event: InteractionEvent) => {
if (props.onFocus) {
props.onFocus(event);
}
Expand Down Expand Up @@ -149,13 +149,11 @@ export default function DBCheckbox(props: DBCheckboxProps) {
disabled={props.disabled}
value={props.value}
required={props.required}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
state.handleChange(event)
}
onBlur={(event: InteractionEvent<HTMLInputElement>) =>
onChange={(event: ChangeEvent) => state.handleChange(event)}
onBlur={(event: InteractionEvent) =>
state.handleBlur(event)
}
onFocus={(event: InteractionEvent<HTMLInputElement>) =>
onFocus={(event: InteractionEvent) =>
state.handleFocus(event)
}
aria-describedby={state._descByIds}
Expand Down Expand Up @@ -191,11 +189,9 @@ export default function DBCheckbox(props: DBCheckboxProps) {
DEFAULT_INVALID_MESSAGE}
</DBInfotext>

<!--
* https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback
//-->
{/* * https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback */}
<span data-visually-hidden role="status">
{state._voiceOverFallback}
</span>
Expand Down
32 changes: 11 additions & 21 deletions packages/components/src/components/input/input.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export default function DBInput(props: DBInputProps) {
label: DEFAULT_LABEL,
placeholder: ' '
},
handleInput: (event: InputEvent<HTMLInputElement>) => {
handleInput: (event: InputEvent) => {
if (props.onInput) {
props.onInput(event);
}
Expand All @@ -56,7 +56,7 @@ export default function DBInput(props: DBInputProps) {
props.input(event);
}
},
handleChange: (event: ChangeEvent<HTMLInputElement>) => {
handleChange: (event: ChangeEvent) => {
if (props.onChange) {
props.onChange(event);
}
Expand Down Expand Up @@ -95,7 +95,7 @@ export default function DBInput(props: DBInputProps) {
state._descByIds = '';
}
},
handleBlur: (event: InteractionEvent<HTMLInputElement>) => {
handleBlur: (event: InteractionEvent) => {
if (props.onBlur) {
props.onBlur(event);
}
Expand All @@ -104,7 +104,7 @@ export default function DBInput(props: DBInputProps) {
props.blur(event);
}
},
handleFocus: (event: InteractionEvent<HTMLInputElement>) => {
handleFocus: (event: InteractionEvent) => {
if (props.onFocus) {
props.onFocus(event);
}
Expand Down Expand Up @@ -184,18 +184,10 @@ export default function DBInput(props: DBInputProps) {
form={props.form}
pattern={props.pattern}
autocomplete={props.autocomplete}
onInput={(event: ChangeEvent<HTMLInputElement>) =>
state.handleInput(event)
}
onChange={(event: ChangeEvent<HTMLInputElement>) =>
state.handleChange(event)
}
onBlur={(event: InteractionEvent<HTMLInputElement>) =>
state.handleBlur(event)
}
onFocus={(event: InteractionEvent<HTMLInputElement>) =>
state.handleFocus(event)
}
onInput={(event: ChangeEvent) => state.handleInput(event)}
onChange={(event: ChangeEvent) => state.handleChange(event)}
onBlur={(event: InteractionEvent) => state.handleBlur(event)}
onFocus={(event: InteractionEvent) => state.handleFocus(event)}
list={props.dataList && state._dataListId}
aria-describedby={state._descByIds}
/>
Expand Down Expand Up @@ -242,11 +234,9 @@ export default function DBInput(props: DBInputProps) {
DEFAULT_INVALID_MESSAGE}
</DBInfotext>

<!--
* https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback
//-->
{/* * https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback */}
<span data-visually-hidden role="status">
{state._voiceOverFallback}
</span>
Expand Down
38 changes: 13 additions & 25 deletions packages/components/src/components/select/select.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,12 @@ export default function DBSelect(props: DBSelectProps) {
_value: '',
initialized: false,
_voiceOverFallback: '',
handleClick: (event: ClickEvent<HTMLSelectElement>) => {
handleClick: (event: ClickEvent) => {
if (props.onClick) {
props.onClick(event);
}
},
handleInput: (event: InputEvent<HTMLSelectElement>) => {
handleInput: (event: InputEvent) => {
if (props.onInput) {
props.onInput(event);
}
Expand All @@ -62,7 +62,7 @@ export default function DBSelect(props: DBSelectProps) {
props.input(event);
}
},
handleChange: (event: ChangeEvent<HTMLSelectElement>) => {
handleChange: (event: ChangeEvent) => {
if (props.onChange) {
props.onChange(event);
}
Expand Down Expand Up @@ -97,7 +97,7 @@ export default function DBSelect(props: DBSelectProps) {
state._descByIds = state._placeholderId;
}
},
handleBlur: (event: InteractionEvent<HTMLSelectElement>) => {
handleBlur: (event: InteractionEvent) => {
if (props.onBlur) {
props.onBlur(event);
}
Expand All @@ -106,7 +106,7 @@ export default function DBSelect(props: DBSelectProps) {
props.blur(event);
}
},
handleFocus: (event: InteractionEvent<HTMLSelectElement>) => {
handleFocus: (event: InteractionEvent) => {
if (props.onFocus) {
props.onFocus(event);
}
Expand Down Expand Up @@ -167,21 +167,11 @@ export default function DBSelect(props: DBSelectProps) {
name={props.name}
value={props.value ?? state._value}
autocomplete={props.autocomplete}
onInput={(event: ChangeEvent<HTMLInputElement>) =>
state.handleInput(event)
}
onClick={(event: ClickEvent<HTMLSelectElement>) =>
state.handleClick(event)
}
onChange={(event: ChangeEvent<HTMLSelectElement>) =>
state.handleChange(event)
}
onBlur={(event: InteractionEvent<HTMLSelectElement>) =>
state.handleBlur(event)
}
onFocus={(event: InteractionEvent<HTMLSelectElement>) =>
state.handleFocus(event)
}
onInput={(event: ChangeEvent) => state.handleInput(event)}
onClick={(event: ClickEvent) => state.handleClick(event)}
onChange={(event: ChangeEvent) => state.handleChange(event)}
onBlur={(event: InteractionEvent) => state.handleBlur(event)}
onFocus={(event: InteractionEvent) => state.handleFocus(event)}
aria-describedby={state._descByIds}>
{/* Empty option for floating label */}
<option hidden></option>
Expand Down Expand Up @@ -255,11 +245,9 @@ export default function DBSelect(props: DBSelectProps) {
DEFAULT_INVALID_MESSAGE}
</DBInfotext>

<!--
* https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback
//-->
{/* * https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback */}
<span data-visually-hidden role="status">
{state._voiceOverFallback}
</span>
Expand Down
32 changes: 11 additions & 21 deletions packages/components/src/components/textarea/textarea.lite.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default function DBTextarea(props: DBTextareaProps) {
rows: '4'
},
_voiceOverFallback: '',
handleInput: (event: InputEvent<HTMLTextAreaElement>) => {
handleInput: (event: InputEvent) => {
if (props.onInput) {
props.onInput(event);
}
Expand All @@ -50,7 +50,7 @@ export default function DBTextarea(props: DBTextareaProps) {
props.input(event);
}
},
handleChange: (event: ChangeEvent<HTMLTextAreaElement>) => {
handleChange: (event: ChangeEvent) => {
if (props.onChange) {
props.onChange(event);
}
Expand Down Expand Up @@ -86,7 +86,7 @@ export default function DBTextarea(props: DBTextareaProps) {
state._descByIds = '';
}
},
handleBlur: (event: InteractionEvent<HTMLTextAreaElement>) => {
handleBlur: (event: InteractionEvent) => {
if (props.onBlur) {
props.onBlur(event);
}
Expand All @@ -95,7 +95,7 @@ export default function DBTextarea(props: DBTextareaProps) {
props.blur(event);
}
},
handleFocus: (event: InteractionEvent<HTMLTextAreaElement>) => {
handleFocus: (event: InteractionEvent) => {
if (props.onFocus) {
props.onFocus(event);
}
Expand Down Expand Up @@ -154,18 +154,10 @@ export default function DBTextarea(props: DBTextareaProps) {
wrap={props.wrap}
spellcheck={props.spellCheck}
autocomplete={props.autocomplete}
onInput={(event: ChangeEvent<HTMLInputElement>) =>
state.handleInput(event)
}
onChange={(event: ChangeEvent<HTMLTextAreaElement>) =>
state.handleChange(event)
}
onBlur={(event: InteractionEvent<HTMLTextAreaElement>) =>
state.handleBlur(event)
}
onFocus={(event: InteractionEvent<HTMLTextAreaElement>) =>
state.handleFocus(event)
}
onInput={(event: ChangeEvent) => state.handleInput(event)}
onChange={(event: ChangeEvent) => state.handleChange(event)}
onBlur={(event: InteractionEvent) => state.handleBlur(event)}
onFocus={(event: InteractionEvent) => state.handleFocus(event)}
value={props.value ?? state._value}
aria-describedby={state._descByIds}
placeholder={
Expand Down Expand Up @@ -200,11 +192,9 @@ export default function DBTextarea(props: DBTextareaProps) {
DEFAULT_INVALID_MESSAGE}
</DBInfotext>

<!--
* https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback
//-->
{/* * https://www.davidmacd.com/blog/test-aria-describedby-errormessage-aria-live.html
* Currently VoiceOver isn't supporting changes from aria-describedby.
* This is an internal Fallback */}
<span data-visually-hidden role="status">
{state._voiceOverFallback}
</span>
Expand Down

0 comments on commit 6854aad

Please sign in to comment.