revert changes to field

This commit is contained in:
Half-Shot 2025-06-19 14:53:59 +01:00
parent 5454c2bfbe
commit cfb2f719fb

View File

@ -60,6 +60,8 @@ interface IProps {
// If specified, contents will appear as a tooltip on the element and
// validation feedback tooltips will be suppressed.
tooltipContent?: JSX.Element | string;
// If specified the tooltip will be shown regardless of feedback
forceTooltipVisible?: boolean;
// If specified, the tooltip with be aligned accorindly with the field, defaults to Right.
tooltipAlignment?: ComponentProps<typeof Tooltip>["placement"];
// If specified alongside tooltipContent, the class name to apply to the
@ -271,6 +273,7 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
validateOnChange,
validateOnFocus,
usePlaceholderAsHint,
forceTooltipVisible,
tooltipAlignment,
...inputProps
} = this.props;
@ -279,7 +282,7 @@ export default class Field extends React.PureComponent<PropShapes, IState> {
const tooltipProps: Pick<React.ComponentProps<typeof Tooltip>, "aria-live" | "aria-atomic"> = {};
let tooltipOpen = false;
if (tooltipContent || this.state.feedback) {
tooltipOpen = this.state.feedbackVisible;
tooltipOpen = (this.state.focused && forceTooltipVisible) || this.state.feedbackVisible;
if (!tooltipContent) {
tooltipProps["aria-atomic"] = "true";