You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Is your feature request related to a problem? Please describe.
Currently, there is no way to apply display: none in OUI. This is important for scenarios when we need access to the DOM elements without actually showing them. For example:
constref=useRef(null);const[show,setShow]=useState(false);useEffect(()=>{// populate ref with DOM elements after some lengthy operationsetShow(true);},[ref]);return(<divref={ref}style={{display: show ? 'block' : 'none'}}/>);
Describe the solution you'd like
The simplest and cleanest way to achieve this would be to add a new CSS utility class called oui-displayNone. This would be the same as the other display utilities, but with display set to none.
I also considered creating a utility component to achieve this. It might look something like this:
return(<OuiConditionalRendercondition={/* boolean value */}>{/* content that is display: none when condition is false */}</OuiConditionalRender>);
However, given the simplicity of the need, I think having an entire component for this would be extremely overkill and not worth the maintaining effort.
Is your feature request related to a problem? Please describe.
Currently, there is no way to apply
display: none
in OUI. This is important for scenarios when we need access to the DOM elements without actually showing them. For example:Describe the solution you'd like
The simplest and cleanest way to achieve this would be to add a new CSS utility class called
oui-displayNone
. This would be the same as the other display utilities, but withdisplay
set tonone
.Other display utilities:
oui/src/global_styling/utility/_utility.scss
Lines 21 to 24 in 71dc4bd
Proposed new utility:
Describe alternatives you've considered
I also considered creating a utility component to achieve this. It might look something like this:
However, given the simplicity of the need, I think having an entire component for this would be extremely overkill and not worth the maintaining effort.
Additional context
This gap was identified in an OUI compliance audit: opensearch-project/OpenSearch-Dashboards#4122
The text was updated successfully, but these errors were encountered: