This is more of a record of how I fixed the problem, rather than a question, in case it helps someone else.
After starting a bios update, the laptop restarted and hung with the message "Flashing Boot Block" showing progress about 90%. It stayed like that overnight.
In the morning I could not switch it off using the power button, so switched off the power cable and let it run out of battery.
Later I plugged it back in, and tried turning it on. I heard the fan spin up briefly twice with a black screen, and on the third attempt it got as far as showing the HP logo with the spinning dots, but turned itself off. I think this might have been it trying to automatically restore the bios as mentioned here.
After that I did not do a hard reset as suggested here, but instead I reset the bios to its defaults as documented here. Firstly, though I disconnected all devices from ports (usb dongles, hdmi etc) in case that confused things.
With all the ports clear, I held down ESC while powering on, and selected F10 to get into the Bios Setup. My Bios screens were a bit different than described in the article, so what I did to reset the bios was:
On the Exit page, select "Load Setup Defaults"
On the Exit page, select "Save Changes and Exit"
The laptop restarted and got to the Windows logon screen. It was ok from there, but I did another restart to make sure.
I would have replied to this post because it was asking about what to do when the power button did not work, but it seemed to be closed.
Be alert for scammers posting fake support phone numbers and/or email addresses on the community. If you think you have received a fake HP Support message, please report it to us by clicking on "Flag Post".