File tree Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Expand file tree Collapse file tree 2 files changed +20
-1
lines changed Original file line number Diff line number Diff line change @@ -117,7 +117,7 @@ function delegateLinkHandler(e) {
117
117
118
118
let t = e . target ;
119
119
do {
120
- if ( t . localName === 'a' && t . getAttribute ( 'href' ) ) {
120
+ if ( t . localName === 'a' && t . getAttribute ( 'href' ) && ! t . isContentEditable ) {
121
121
if ( t . hasAttribute ( 'data-native' ) || t . hasAttribute ( 'native' ) ) return ;
122
122
// if link is handled by the router, prevent browser defaults
123
123
if ( routeFromLink ( t ) ) {
Original file line number Diff line number Diff line change @@ -118,6 +118,25 @@ describe('dom', () => {
118
118
expect ( onChange ) . not . toHaveBeenCalled ( ) ;
119
119
expect ( location . href ) . toContain ( '#foo' ) ;
120
120
} ) ;
121
+
122
+ it ( 'should not intercept links inside contenteditable' , ( ) => {
123
+ let onChange = jasmine . createSpy ( ) ;
124
+ mount (
125
+ < div >
126
+ < div contenteditable >
127
+ < a href = "#foo" > foo</ a >
128
+ </ div >
129
+ < Router onChange = { onChange } >
130
+ < div default />
131
+ </ Router >
132
+ </ div >
133
+ ) ;
134
+ onChange . calls . reset ( ) ;
135
+ act ( ( ) => {
136
+ $ ( 'a' ) . click ( ) ;
137
+ } ) ;
138
+ expect ( onChange ) . not . toHaveBeenCalled ( ) ;
139
+ } ) ;
121
140
} ) ;
122
141
123
142
describe ( 'Router' , ( ) => {
You can’t perform that action at this time.
0 commit comments