Dialog: Class is applied twice
Environment Information
- Package version(s): 6.145.0+
Please provide a reproduction of the bug in a codepen:
https://codepen.io/erichdev/pen/rRmagV
Actual behavior:
Not sure if this is intended behavior, but when a className is passed to Dialog, it is applied twice:
<Dialog className='XXXXXXXXX' /> results in:
<div class="ms-Layer ms-Layer--fixed ms-Dialog XXXXXXXXX root-62" data-portal-element="true">
<div class="ms-Fabric ms-Layer-content content-65">
<div role="alertdialog" aria-modal="true" aria-labelledby="Dialog4-title" aria-describedby="Dialog4-subText" style="outline: none;">
<div class="ms-Modal is-open ms-Dialog XXXXXXXXX root-64">
With 6.144.0 and below, this is the result:
<div class="ms-Layer ms-Layer--fixed root-61" data-portal-element="true">
<div class="ms-Fabric ms-Layer-content content-64">
<div role="alertdialog" aria-modal="true" aria-labelledby="Dialog4-title" aria-describedby="Dialog4-subText" style="outline: none;">
<div class="ms-Modal is-open ms-Dialog XXXXXXXXX root-63">
I blieve it is the result of this PR: https://github.com/OfficeDev/office-ui-fabric-react/pull/8065 But I don't know if this is intended behavior for the sticky feature to work.
Priorities and help requested:
Are you willing to submit a PR to fix? No
Requested priority: Low
Products/sites affected: SPO. This affected a test, but no other effects as far as I can tell.
@jspurlin could you advise on whether this is a result of PR and we mean to keep it?
@aftab-hassan Yes, it looks like it is a result of that PR and it seems like it should be something more like
// if the modal is modeless, add the classname to correctly style the layer
let layerClassName = layerProps && layerProps.className;
if (isModeless) {
layerClassName = layerClassName ?
`${layerClassName} ${classNames.layer}` : classNames.layer;
}
the modal className is getting incorrectly applied to the layer. It looks like was trying to only update the layer's className if needed but was using the props.className instead of layerProps.ClassName.
Yes, this can be removed
@jspurlin are you fixing it?
:tada:This issue was addressed in #8273, which has now been successfully released as [email protected].:tada:
Handy links: