  We study the group of type-preserving automorphisms of a right-angled
building, in particular when the building is locally finite. Our aim is to
characterize the proper open subgroups as the finite index closed subgroups of
the stabilizers of proper residues.
  One of the main tools is the new notion of firm elements in a right-angled
Coxeter group, which are those elements for which the final letter in each
reduced representation is the same. We also introduce the related notions of
firmness for arbitrary elements of such a Coxeter group and $n$-flexibility of
chambers in a right-angled building. These notions and their properties are
used to determine the set of chambers fixed by the fixator of a ball. Our main
result is obtained by combining these facts with ideas by Pierre-Emmanuel
Caprace and Timoth\'ee Marquis in the context of Kac-Moody groups over finite
fields, where we had to replace the notion of root groups by a new notion of
root wing groups.
