Skip to content

Commit

Permalink
Fix primefaces#4568: Calendar remove focusState as its not needed
Browse files Browse the repository at this point in the history
  • Loading branch information
melloware committed Jun 30, 2023
1 parent 8f41a97 commit 983aa5e
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions components/lib/calendar/Calendar.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,11 @@ export const Calendar = React.memo(
React.forwardRef((inProps, ref) => {
const context = React.useContext(PrimeReactContext);
const props = CalendarBase.getProps(inProps, context);
const [focusedState, setFocusedState] = React.useState(false);
const [overlayVisibleState, setOverlayVisibleState] = React.useState(false);
const [viewDateState, setViewDateState] = React.useState(null);
const { ptm } = CalendarBase.setMetaData({
props,
state: {
focused: focusedState,
overlayVisible: overlayVisibleState,
viewDate: viewDateState
}
Expand Down Expand Up @@ -71,20 +69,17 @@ export const Calendar = React.memo(

const onInputFocus = (event) => {
if (ignoreFocusFunctionality.current) {
setFocusedState(true);
ignoreFocusFunctionality.current = false;
} else {
if (props.showOnFocus && !visible) {
show();
}

setFocusedState(true);
props.onFocus && props.onFocus(event);
}
};

const onInputBlur = (event) => {
setFocusedState(false);
!props.keepInvalid && updateInputfield(props.value);
props.onBlur && props.onBlur(event);
};
Expand Down Expand Up @@ -3611,8 +3606,7 @@ export const Calendar = React.memo(
[`p-calendar-w-btn p-calendar-w-btn-${props.iconPos}`]: props.showIcon,
'p-calendar-disabled': props.disabled,
'p-calendar-timeonly': props.timeOnly,
'p-inputwrapper-filled': props.value || (DomHandler.hasClass(inputRef.current, 'p-filled') && inputRef.current.value !== ''),
'p-inputwrapper-focus': focusedState
'p-inputwrapper-filled': props.value || (DomHandler.hasClass(inputRef.current, 'p-filled') && inputRef.current.value !== '')
});
const panelClassName = classNames('p-datepicker p-component', props.panelClassName, {
'p-datepicker-inline': props.inline,
Expand Down

0 comments on commit 983aa5e

Please sign in to comment.