File tree Expand file tree Collapse file tree 2 files changed +19
-10
lines changed
Expand file tree Collapse file tree 2 files changed +19
-10
lines changed Original file line number Diff line number Diff line change 11# NHS digital service manual Changelog
22
3+ ## Unreleased
4+
5+ :wrench : ** Maintenance**
6+
7+ - Resize example iframes when contents changes size
8+
39## 8.7.0 - 17 February 2026
410
511:new : ** New features**
Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ export class DesignExample extends Component {
2020 this . closeButtons = this . $root . querySelectorAll ( '.app-button--close' )
2121 this . copyButtons = this . $root . querySelectorAll ( '.app-button--copy' )
2222 this . iframe = this . $root . querySelector ( 'iframe' )
23+ this . state = { isMouseDown : false }
2324
2425 this . bindEvents ( )
2526
@@ -88,19 +89,21 @@ export class DesignExample extends Component {
8889 }
8990
9091 if ( this . iframe ) {
91- initialize (
92- {
93- // Prevent resize when iframe has mouse cursor
94- // e.g. When resizing manually using handle
95- onBeforeIframeResize ( { interactionState } ) {
96- return ! interactionState . isHovered
97- }
98- } ,
99- this . iframe
100- )
92+ const { iframe, state } = this
93+
94+ iframe . addEventListener ( 'mousedown' , ( ) => ( state . isMouseDown = true ) )
95+ iframe . addEventListener ( 'mouseup' , ( ) => ( state . isMouseDown = false ) )
96+
97+ initialize ( { onBeforeIframeResize : ( ) => this . isResizeAllowed ( ) } , iframe )
10198 }
10299 }
103100
101+ isResizeAllowed ( ) {
102+ // Prevent resize when iframe has mouse down
103+ // e.g. When resizing manually using handle
104+ return ! this . state . isMouseDown
105+ }
106+
104107 handleTabClick ( $tabLink ) {
105108 const $tabParent = $tabLink . parentElement
106109 const index = $tabParent . dataset . index
You can’t perform that action at this time.
0 commit comments