1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 01:39:44 +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, updateFeatureFlags,
UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS', UPDATE_FEATURE_FLAGS: 'UPDATE_FEATURE_FLAGS',
setMouseUserState,
SET_MOUSE_USER_STATE: 'SET_MOUSE_USER_STATE',
// Network // Network
setNetworkEndpoints, setNetworkEndpoints,
updateNetworkEndpointType, updateNetworkEndpointType,
@ -1661,6 +1664,13 @@ function updateFeatureFlags (updatedFeatureFlags) {
} }
} }
function setMouseUserState (isMouseUser) {
return {
type: actions.SET_MOUSE_USER_STATE,
value: isMouseUser,
}
}
// Call Background Then Update // Call Background Then Update
// //
// A function generator for a common pattern wherein: // A function generator for a common pattern wherein:

View File

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

View File

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

View File

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