How to set the facet block title to the currently applied filter? I have a faceted block for the taxonomy reference field.

The faceted block displays the parent terms. When I click on a term in the faceted block then its childs displays in the faceted block. It is fine but the facet block title should be changed to its parent term name.

How will I do this?
I'm not sure about faceted, bacause i've never used it before.
But if page are reloads on click you can use hook_block_view_alter hook the common workflow of using this - get param from url and replace title depends on it.

If page doesn't reloads you can use ajax command, or something similar to achieve what's you need.