1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-22 17:33:23 +01:00

Remove chrome focus outline for mouse users. (#3230)

This commit is contained in:
Dan J Miller 2018-02-12 14:15:53 -03:30 committed by Alexander Tseung
parent 7f70943fa2
commit fe2ed68f11
4 changed files with 40 additions and 1 deletions

View File

@ -257,6 +257,9 @@ var actions = {
updateFeatureFlags,
UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS',
setMouseUserState,
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
// Network
setNetworkEndpoints,
updateNetworkEndpointType,
@ -1661,6 +1664,13 @@ function updateFeatureFlags (updatedFeatureFlags) {
}
}
function setMouseUserState (isMouseUser) {
return {
type: actions.SET_MOUSE_USER_STATE,
value: isMouseUser,
}
}
// Call Background Then Update
//
// A function generator for a common pattern wherein:

View File

@ -85,6 +85,7 @@ function mapStateToProps (state) {
lostAccounts: state.metamask.lostAccounts,
frequentRpcList: state.metamask.frequentRpcList || [],
currentCurrency: state.metamask.currentCurrency,
isMouseUser: state.appState.isMouseUser,
// state needed to get account dropdown temporarily rendering from app bar
identities,
@ -101,6 +102,7 @@ function mapDispatchToProps (dispatch, ownProps) {
hideNetworkDropdown: () => dispatch(actions.hideNetworkDropdown()),
setCurrentCurrencyToUSD: () => dispatch(actions.setCurrentCurrency('usd')),
toggleAccountMenu: () => dispatch(actions.toggleAccountMenu()),
setMouseUserState: (isMouseUser) => dispatch(actions.setMouseUserState(isMouseUser)),
}
}
@ -112,7 +114,13 @@ App.prototype.componentWillMount = function () {
App.prototype.render = function () {
var props = this.props
const { isLoading, loadingMessage, network } = props
const {
isLoading,
loadingMessage,
network,
isMouseUser,
setMouseUserState,
} = props
const isLoadingNetwork = network === 'loading' && props.currentView.name !== 'config'
const loadMessage = loadingMessage || isLoadingNetwork ?
`Connecting to ${this.getNetworkName()}` : null
@ -120,11 +128,19 @@ App.prototype.render = function () {
return (
h('.flex-column.full-height', {
className: classnames({ 'mouse-user-styles': isMouseUser }),
style: {
overflowX: 'hidden',
position: 'relative',
alignItems: 'center',
},
tabIndex: '0',
onClick: () => setMouseUserState(true),
onKeyDown: (e) => {
if (e.keyCode === 9) {
setMouseUserState(false)
}
},
}, [
// global modal

View File

@ -1 +1,7 @@
// Base
.mouse-user-styles {
button:focus {
outline: 0;
}
}

View File

@ -59,6 +59,7 @@ function reduceApp (state, action) {
// Used to display error text
warning: null,
buyView: {},
isMouseUser: false,
}, state.appState)
switch (action.type) {
@ -658,6 +659,12 @@ function reduceApp (state, action) {
data: action.value.data,
},
})
case actions.SET_MOUSE_USER_STATE:
return extend(appState, {
isMouseUser: action.value,
})
default:
return appState
}