MethodBackdropControls

 
 
 
 

Overview

Backdrop filter controls — blur, brightness, contrast, saturation, hue rotation, grayscale, invert and sepia — applied to whatever shows through a semi-transparent element, per breakpoint.

  • File: lib/blocks/components/MethodBackdropControls.js
  • Panel label: “Background Filters” by default; the Section block names it “Background Overlay Filters”
  • Breakpoints: Any — each instance edits one tier of responsiveSettings; blocks place one at the base breakpoint and one in each responsive tab
  • Settings key: responsiveSettings.{breakpoint}.backdrop

Props

PropTypeDefaultDescription
breakpointstring(required)The tier to edit: base, mobile, tablet or wide.
attributesobject(required)The block’s full attributes object.
setAttributesfunction(required)WordPress setAttributes.
includearray['blur', 'brightness', 'contrast', 'grayscale', 'hueRotate', 'saturate', 'invert', 'sepia']Which filters the panel offers, in the panel’s own order (blur, brightness, contrast, saturation, hue rotate, grayscale, invert, sepia).
controlLabelstring"Background Filters"The ToolsPanel heading.

Controls

Every filter is a ToolsPanelItem; nothing is stored until it is switched on. The stored value is the CSS function argument, so what you see in the input is what reaches the stylesheet.


Blur

  • Settings key: backdrop.blur
  • UI: UnitControl, px only, minimum 0
  • On select: "0px"
  • CSS: blur(…)

Brightness, Contrast, Saturation

  • Settings keys: backdrop.brightness, backdrop.contrast, backdrop.saturate
  • UI: UnitControl, % only, minimum 0
  • On select: "100%" — the neutral value
  • CSS: brightness(…), contrast(…), saturate(…)

Hue Rotate

  • Settings key: backdrop.hueRotate
  • UI: UnitControl, deg only, 0–360
  • On select: "0deg"
  • CSS: hue-rotate(…) — the one key that is renamed on output

Grayscale, Invert, Sepia

  • Settings keys: backdrop.grayscale, backdrop.invert, backdrop.sepia
  • UI: RangeControl, 0–1 in steps of 0.01, stored as a number
  • On select: 0
  • CSS: grayscale(…), invert(…), sepia(…)

ToolsPanel Behavior

  • onSelect: writes the neutral starting value shown above into backdrop for the tier.
  • onDeselect: deletes that one key. When the last key goes, the backdrop object itself is removed from the tier rather than left empty.
  • Reset all: removes backdrop from the tier.
  • The component writes only responsiveSettings[breakpoint].backdrop; every other key of the tier is spread through untouched.

CSS Output

method_get_block_responsive_styles() (through method_get_block_css_declarations() in lib/blocks.php) and MethodStyleTag both turn the object into one backdrop-filter declaration: each set key becomes name(value), joined with spaces, for the tier’s media query.

CSS
/* responsiveSettings.base.backdrop = { "blur": "6px", "saturate": "140%", "grayscale": 0.5 } */
#method-68f1b2c3a4d5e > .method-container-content {
    backdrop-filter: blur(6px) saturate(140%) grayscale(0.5);
}

The block decides which element receives it by listing backdrop in its CSS map: Container applies it to > .method-container-content, Section to its shade overlay > .method-section-content > .method-section-shade, so the filter acts on what shows through the overlay.

One difference between the two renderers: PHP skips a key whose value is empty(), so a range filter left at 0 is dropped on the page, while the editor only drops null, undefined and "" and will preview grayscale(0). Both are visually neutral.


Usage by Blocks

BlockNotes
ContainerBase and all three responsive tabs since beta21 (base only in beta20); the default panel label; applied to .method-container-content.
SectionBase and all three responsive tabs; controlLabel="Background Overlay Filters"; applied to .method-section-shade.

Changelog

VersionDescription
2.0.0-beta20Introduced, for the Container block at the base breakpoint, with the backdrop property in the CSS generators (ae61c10).
2.0.0-beta21Offered in the responsive tabs as well, added to the Section block’s shade overlay, and given the controlLabel prop (75910d2).