masto-fe/app/javascript/mastodon/reducers/modal.js
ThibG a12f1a0baf Improve dropdown menu keyboard navigation (#11491)
* Allow selecting menu items with the space bar in status dropdown menus

* Fix modals opened by keyboard navigation being immediately closed

* Fix menu items triggering modal actions

* Add Tab trapping inside dropdown menu

* Give focus back to last focused element when status dropdown menu closes
2019-08-06 11:59:46 +02:00

17 lines
469 B
JavaScript

import { MODAL_OPEN, MODAL_CLOSE } from '../actions/modal';
const initialState = {
modalType: null,
modalProps: {},
};
export default function modal(state = initialState, action) {
switch(action.type) {
case MODAL_OPEN:
return { modalType: action.modalType, modalProps: action.modalProps };
case MODAL_CLOSE:
return (action.modalType === undefined || action.modalType === state.modalType) ? initialState : state;
default:
return state;
}
};