2

When opening an SLDS modal in a community lightning component, the document body remains scrollable behind the modal backdrop. In visualforce, I would simply add a class or edit the style property of the <body> element to disable scroll when my modal was open, then restore the default behavior on modal close. However, the Locker Service paradigm is that I cannot modify elements that I do not own and I clearly do not own the document body in a community.

Is there another way I can stop the page background from scrolling when I open a modal that obeys the rules of Locker Service? Having the background scroll becomes a real UX issue when the modal contains scrollable content as well.

1 Answer 1

3

document.body and document.head are 2 nodes that support "shared" ownership and you should be able to manipulate either directly under Locker. Locker will keep you from accessing, deleting, etc child nodes of body/head that you do not own but you can add/remove etc children you own, apply CSS, etc.

1
  • That is excellent news. Is there documentation anywhere on these shared nodes?
    – dsharrison
    Commented Dec 2, 2016 at 15:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .