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: Trunk Lid
WARNING
Never allow a person to ride in the trunk: Allowing a person to ride
in the trunk is dangerous. The person in the trunk could be seriously injured or
killed during sudden braking or a collision.
Do not drive with the trunk lid open: Exhaust gas in the cabin of a vehicle
is dangerous. ...
Mazda 6 Owners Manual: Sunroof relay inspection
Note
Sunroof relay is built in the sunroof motor.
1. Remove the headliner. (See HEADLINER REMOVAL/INSTALLATION.)
2. Connect the sunroof switch connector.
3. Measure the voltage at the sunroof relay terminals as indicated below.
4. Disconnect the sunroof relay connector before inspecting fo ...