Skip to content

🐞Broken experience with custom web parts in colored sections on modern experience pages #3391

@StfBauer

Description

@StfBauer

Category

  • Question
  • Typo
  • Bug
  • Additional article idea

Expected or Desired Behavior

Web part should inherit at least background and font colour at least from the '.CanvasZoneContainer' instead of faulty overspecify styles.

Observed Behavior

Placing a web part with no styling at all lead to the following experience:

screenshot 2019-02-03 at 14 12 22

The issue is caused because .CanvasZone, .CanvasSection, .Controlzone, .ControlZoneEmphasisBackground overspecify a background color of white on each of the containers. In the end, a third party web part end up with white text on white background. The colour on the hand is not "overspecificed".

screenshot 2019-02-03 at 14 12 35

The web part, in this case, doesn't use any styling at all and just render 'Hello World'.

An intermediate fix to this issue can be accomplished with the following CSS that forces to the inheritance of 'background-color' and color properties from the '.CanvasZoneContainer' element where the "Colored Section" base properties are defined.

:global {
  .CanvasZone,
  .CanvasSection,
  .Controlzone,
  .ControlZoneEmphasisBackground {
    background-color: inherit;
    color: inherit;
  }
}

The result of this fix is a correct displayed web part.

screenshot 2019-02-03 at 14 24 34

This fix works for the 'Neural':
screenshot 2019-02-03 at 14 27 19

As well as 'Soft':
screenshot 2019-02-03 at 14 28 25

as well as 'None':
screenshot 2019-02-03 at 14 29 39

Steps to Reproduce

  • Create an empty web part that does not have any style included at all.
  • Place the web part on a colored section on a SharePoint Page.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:docsCategory: SharePoint developer/development documentation relatedarea:spfxCategory: SharePoint Framework (not extensions related)type:bug-suspectedSuspected bug (not working as designed/expected). See “type:bug-confirmed” for confirmed bugs.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions