Closes #2988018
Note this merge request contains commits from [#3397622]: we will need to rebase onto 11.x when [#3397622] is accepted.