The sunshade can be opened and closed by hand.
The sunshade opens automatically when the moonroof is opened, but must be closed by hand.

CAUTION
Jam-safe Moonroof
Security SystemMazda 6 Owners Manual: Indication on Display
The Distance Recognition Support System (DRSS) operation status is indicated
in the active driving display or multi-information display. Regarding malfunctions,
check the vehicle conditions or have it inspected by an Authorized Mazda Dealer
according to the content of the displayed message.
R ...
Mazda 6 Owners Manual: Ignition switch inspection
1. Disconnect the negative battery cable.
2. Remove the column cover. (See COLUMN COVER REMOVAL/INSTALLATION)
3. Disconnect the ignition switch connectors.
4. Inspect for continuity between the ignition switch terminals using an
ohmmeter.
If not as specified, replace the ignition switch.
...